C # solution to the error message returned when the callback parameter is invalid

Source: Internet
Author: User
Tags stack trace

C # solution to the error message returned when the callback parameter is invalid

Suddenly an error occurs: "The Callback or 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.


Solution:

If the data binding control is used on the page, bind the data
If (! Ispostback)
{
Datainit ();
}


If not, set the enableeventvalidation attribute on the page to false.
<% @ Page language = "c #" autoeventwireup = "true" codebehind = "localuser. asp tutorial x. cs "inherits =" sklgp. workstation. web. page. mainframe. manage. localuser "enableeventvalidation =" false "%>


Other solutions with the error "sending back or invalid callback parameters"


Error Description: the error message returned or 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.

Note: an unhandled exception occurs during the execution of the current web request. Check the stack trace information for details about the error and the source of the error in the code.


Error cause:

1 is form nesting. A page can only have one form. You can solve this problem by checking the code carefully.


2. Use webpage special effects to change the content (such as ajax) in the drop-down menu)

Solution:

For errors caused by the first reason, you only need to ensure that the page has only one form.

For errors caused by the second reason, you need to change the dropdownlist control to the html select control.


When implementing the cascade menu, an error suddenly occurs. Other solutions

Solution:

You can replace the dropdownlist control with select when you perform the cascade menu, for example:

Ui -->

<Asp: dropdownlist id = "ddlcity" runat = "server">

</Asp: dropdownlist>

C # -->

String cityname = this. ddcity. selecteditemvalue;

Replace:

Ui -->

<Select id = "ddlcity" runat = "server">

</Select>

C #->

String cityname = request [this. ddlcity. uniqueid]

4. The value attribute of the listitem in the dropdownlist control contains Chinese characters. You only need to change the value to English or numbers.

 

Related Article

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.