最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Invalid postback or callback argument error? - Stack Overflow

programmeradmin4浏览0评论

I have two dropdownlists and I am filling one based on the other using javascript. In my javascript code I am calling for a webservice and with the results returned I fill the other dropdownlist. The problem is that after I have done that successfully the following error started to occur:

Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

Any idea ?

I have two dropdownlists and I am filling one based on the other using javascript. In my javascript code I am calling for a webservice and with the results returned I fill the other dropdownlist. The problem is that after I have done that successfully the following error started to occur:

Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

Any idea ?

Share Improve this question edited Jul 28, 2023 at 12:52 Daniel A. White 191k49 gold badges379 silver badges463 bronze badges asked Dec 9, 2011 at 9:17 yahya khyahya kh 7513 gold badges11 silver badges23 bronze badges
Add a comment  | 

5 Answers 5

Reset to default 6

If you want to modify generated controls from client side, you have to disable eventvalidation or register all possible values with RegisterForEventValidation. It's well explained here. It's because the data sent to the client and received after by the server differs.

edit:also responded here.

I got same Error when i got one of my clients project. It is related to the web.config file. Simply Paste the below code under appSettings in config file.

<add key="PageInspector:ServerCodeMappingSupport" value="Disabled" />

I had to change the web.config in IIS

<configuration>
    <system.web>
        <pages enableEventValidation="false"/>
    </system.web>
</configuration>

My problem was solved when cancel event at end of grid event at server side.

protected void grdEducation_RowEditing(object sender, GridViewEditEventArgs e)
{
  // do your processing ... 

  // at end     
  e.Cancel = true;
}

Add your respective control in the update panel it will resolve the issue.

<telerik:AjaxUpdatedControl ControlID="btnSearch" />

发布评论

评论列表(0)

  1. 暂无评论