Solution for "sending back or callback parameters invalid" in ASP. NET 2.0

Source: Internet
Author: User
During the two-day development, I encountered a problem: an error was reported when I used the server button event after the Ajax linkage drop-down box:
The callback parameter is invalid. Use in configuration

Or enable event verification on the page. 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.
After checking on the Internet, the general explanation for this error is:
So far, there are two situations:
First, form nesting. A page can only have one form. You can solve this problem by checking the code carefully.
Second, Ajax is used in the drop-down menu, which is common in the provincial/municipal linkage menu. It may be because the initial item value of the drop-down menu is assigned to the ASPX page. This error is prompted when the event is returned, delete the initial item value from the drop-down menu and add the item to the binding event.
The solution is as follows:
In the subsequent code, use request. Form ["ddlcity"]; To obtain the value of the dropdownlist, instead of ddlcity. selectedvalue. The general reason is that AJAX changes the page content. The control value in the page content sent back to the server is no longer normal and can only be obtained through the original method.
This result is inconvenient. In addition, when the page is sent to the client again, the content of the dropdownlist control is disordered, And the Ajax advantage is lost. You need to reset the dropownlist content on the server side based on the transmitted information. There is no perfect solution yet.
I have never tried Microsoft's Ajax. I don't know if the same problem exists. I think it should be none.

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.