Hi all,
I have two asp.net web pages 1)CustomerVendorDetails 2)AddEditCustomerVendorDetails.
CustomerVendorDetails page is used to display all customer/vendor details in a gridview, AddEditCustomerVendorDetails page is used to Add and Edit customer/vendor details.
In CustomerVendorDetails page gridview is used to display the all customer/vendor details, if user want to edit a particula customer/vendor details he/she will click on Edit button of corresponding row, all the field values of that row will redirect to correspondig controls in AddEditCustomerVendorDetails page.
Here i used Imagebutton instade of linkbutton for row edit that code is as follows:
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="ibEdit" runat="server" CausesValidation="False" CommandName="Edit"
ImageUrl="~/images/Edit.gif" ToolTip="Edit" CommandArgument='<%# Container.DataItemIndex %>'></asp:ImageButton>
</ItemTemplate>
</asp:TemplateField>
Gridviews RowCommand event code is as follows:
protected void gvCustomerVendorDetails_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Edit")
{
int igvCustomerVendorDetailsIndex = Convert.ToInt32(e.CommandArgument);
GridViewRow gvCustomerVendorDetailsRow = gvCustomerVendorDetails.Rows[igvCustomerVendorDetailsIndex];
Session["CusVenID"] = gvCustomerVendorDetails.DataKeys[igvCustomerVendorDetailsIndex].Value;
Response.Write("~/AddEditCustomerVendorDetails.aspx?AddEdit=Edit");
}
}
Whenever i clicks on ImageButton its showing an error that is:
System.ArgumentException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
please any body help me to solve this error.
Thanks in advance
Uday