Wednesday, August 28, 2013

Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %> in a page

Error : 
Invalid postback or callback argument.  
Event validation is enabled using 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.   at System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument)

Reason:
Multiple time binding grid might cause this error


Solution:
Add the Condition before binding

if (!Page.IsPostBack)  
{  
              DGD_Attachments.DataSource = dr;
              DGD_Attachments.DataBind();

}

No comments: