0

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.

1 Answer 1

4

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.

1
  • 1
    It wasn't a waste: you were waiting for Ahmad's answer, and now you have it, and won't make the same mistake again. Commented Jul 5, 2009 at 0:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.