asp.net - WebForms Unobtrusive Validation Mode -


i encountered error using regular expression validator.

1) create asp.net empty application (as webapplication) 2) add web form in webapplication 3) add following line:

inside <head></head>

4) create folder "script", still inside webapplication tree 5) add jquery-1.8.2.js file inside folder 6) inside div below form add 2 textbox:

<asp:textbox id="a" name="a" type="text" size="50" maxlength="100" runat="server" />     <asp:textbox id="b" name="b" type="text" size="50" maxlength="100" runat="server" /> 

7) each textbox add regularexpressionvalidator, code be:

<asp:textbox id="a" name="a" type="text" size="50" maxlength="100" runat="server" />     <asp:regularexpressionvalidator                  validationgroup="alpha" id="controla"                 runat="server" errormessage="*" controltovalidate="a"                  validationexpression=".{10}">             </asp:regularexpressionvalidator>     <asp:textbox id="b" name="b" type="text" size="50" maxlength="100" runat="server" />             <asp:regularexpressionvalidator                  validationgroup="beta" id="controlb"                 runat="server" errormessage="*" controltovalidate="b"                  validationexpression=".{2}"> 

8) create button below text boxes:

<asp:button id="button1" runat="server" onclick="button1_click" text="button" /> 

9) in button method "button_click" create string check if works: protected void button1_click(object sender, eventargs e) { string text = a.text + " " + b.text; }

10) run program.

11) error like: description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code.

exception details: system.invalidoperationexception: webforms unobtrusivevalidationmode requires scriptresourcemapping 'jquery'. please add scriptresourcemapping named jquery(case-sensitive).

my version of vs is: 12.0.30501.00 update 2. .net framework: 4.5.51641 tried ie , chrome, jquery-1.8.2.js , jquery-2.1.1.js windows 8.1 enterprise.

remove line in web.config :

<add key="validationsettings:unobtrusivevalidationmode" value="webforms" /> 

or add line on web.config :

<add key="validationsettings:unobtrusivevalidationmode" value="none" /> 

or in global.asax :

validationsettings.unobtrusivevalidationmode = system.web.ui.unobtrusivevalidationmode.none 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -