Question

I included a repeater in my master page. The repeater has a button that I set its CommandArgument.

However when I click the button I get the following exception:

System.ArgumentException: 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.


And it doesn't continue to the event handler.

Note: I tried adding these lines to the master page but it doesn't help:

protected override void Render(HtmlTextWriter writer)
{
    Page.ClientScript.RegisterForEventValidation(rptrLanguages.ClientID);
    base.Render(writer);
}

Thanks.

Was it helpful?

Solution

Are you doing any databinding on that page? If so, is it happening between a check for !IsPostBack ?

if (!IsPostBack) { // do databinding }

A similar issue was mentioned here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top