The error message returned when the callback parameter is invalid. Enable event verification in configuration or on the page .』 Problem

Source: Internet
Author: User

Error description:The callback parameter is invalid. Use <pages enableeventvalidation = "true"/> in the configuration, or use <% @ page enableeventvalidation = "true" %> On the page to enable event verification. For security purposes, this function verifies whether the parameters of the send-back or callback events come from the server controls that initially present these events. If the data is valid and is expected, use the clientscriptmanager. registerforeventvalidation method to register the sending back or callback data for verification.

When I encountered the above problems in some programs today, the problem was solved:

1. Context: I used to write a project in vs.net 2003. Now I want to add new functions. I want to write it in the vs.net 2005 Environment and add gridaview to the new page, bind imagebutton to the template column and have related click events;

2. Problem description: The compilation is successful, and the above error description appears at runtime;

3. Solution attempts:

A. Set enableeventvalidation to false and no error is returned. When the program cannot find the sender object in the event (this object is required for the function of this program );

B. enableeventvalidation: place the functions of the imagebutton event into the rowcommand event,

When the program cannot trigger the rowcommand event at all;

C. It is suspected that it is the reason for the configuration file. Therefore, if you change web. config to the configuration file of vs.net 2005, no error is returned during running, but the preceding error message is reported when you click imagebutton in the gridview;

According to the above attempt, the value of enableeventvalidation is set to false. Although no error is reported, the symptoms are not fixed;

4. Solution: I searched a lot of information on the Internet and found two types of problems. One is nested form in form, and the other is three levels of interaction using Ajax technology; however, this situation does not belong to the above two types. Most solutions are to set enableeventvalidation to false, and finally find the solution, that is, in if (! Page. ispostback. According to my understanding, when the page is initially loaded, it is bound to the gridview, and the server control is registered to the page. Then, when the event is triggered, enableeventvalidation's verification function finds the Server Control for sending back or callback events, therefore, server events can be triggered.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.