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.