an Id in this form to save the selected ...">

Page enableEventValidation = "true" error

I create a client insertion form, there is <asp:HiddenField/>an Id in this form to save the selected client identifier, but when I try to submit the form, it is on error Page enableEventValidation="true", when I rename it HiddenFieldfor any other Id, it works

<asp:HiddenField runat="server" ID="Id" />

My form may represent success when I set enableEventValidation = "false", but maybe I will need it in the future

How to solve this problem? save HiddenFieldwith nameId

PrintScreen: error message screen

+4
source share
3 answers

. - enableEventValidation="false" HiddenField

+3

, .

  (!IsPostBack)
{
  binddata(); //this was my gridview binding function
}
+1

4.0, web.config()

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

4.5, web.config(requestValidationMode = "2.0" )

<system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" requestValidationMode="2.0"/>
</system.web>

0

Source: https://habr.com/ru/post/1527459/


All Articles