Invalid postback or callback argument. Event validation is enabled using ''

后端 未结 30 1435
生来不讨喜
生来不讨喜 2020-11-22 05:08

I am getting the following error when I post back a page from the client-side. I have JavaScript code that modifies an asp:ListBox on the client side.

How do we fix

30条回答
  •  灰色年华
    2020-11-22 05:15

    This was the reason why I was getting it:

    I had an ASP:ListBox. Initially it was hidden. At client side I would populate it via AJAX with options. The user chose one option. Then when clicking the Submit button, the Server would get all funny about the ListBox, since it did not remember it having any options.

    So what I did is to make sure I clear all the list options before submitting the form back to the server. That way the server did not complain since the list went to the client empty and it came back empty.

    Sorted!!!

提交回复
热议问题