Aspx error: the sending back or callback parameter is invalid. Enable event verification in configuration or on the page ......

Source: Internet
Author: User

The callback parameter is invalid. Use in 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.

 

To put it simply, I encountered the error page content.

On the page, there are two dropdownlist drop-down boxes, linked. When loading, the data read from the database is bound to the two drop-down boxes.

Click the button to return to the call background method to save the data. After you click bottom, the above error is reported.

 

I checked some information and said it was caused by the situation in 2.

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.

 

I have checked it. It is not the reason for from nesting. This is probably the second case.

How can this problem be solved? The following methods are found.

1. Add the following statement to Web. config:
<Globalization requestencoding = "UTF-8" responseencoding = "UTF-8" Culture = "ZH-CN" uiculture = "ZH-CN"/>

 

2
In <% @ page
Language = "C #" autoeventwireup = "true" codefile = "default. aspx. cs"
Inherits = "_ default" %>

Added enableeventvalidation = "false"

 


Method 1: I tried it. It doesn't seem to work very well. I don't know if the position in config is incorrect. (You know, can you elaborate on it .)

Method 2 has not been tried.

 

 

The following describes my methods.

Two drop-down boxes do not use the dropdownlist control. Select label is used.

How can I bind data without controls? Of course. After the page is loaded and read from the library, a javascript string is generated.

Use clientscript. registerclientscriptblock (type, key script) to register to the page. Then, call the Javascript section in window. onload at the front end.

At this time, the above error will not appear after you click the button.

 

But there is a problem. After submission, how can I get the value of the selected item in the drop-down box ?.

Add name to select, and then use request. Form ["selname"]; To obtain the value of the selected item.

 

Adding runat = "server" is useless. The result is always null.

 

If you have other methods to solve this problem, please kindly advise.

 

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.