c# - asp.net: RequiredFieldValidator in TemplateFiled for DetailsView does not work at run time -
i'm trying add validator template in detailsview control, @ run time encounter error:
server error in '/' application.
webforms unobtrusivevalidationmode requires scriptresourcemapping 'jquery'. please add scriptresourcemapping named jquery(case-sensitive). 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).
source error:
an unhandled exception generated during execution of current web request. information regarding origin , location of exception can identified using exception stack trace below.
below, program in visual studio 2017.
<%@ page language="c#" autoeventwireup="true" codebehind="inserttitlebytemplate.aspx.cs" inherits="webappaspazdataconn.inserttitlebytemplate" %> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:detailsview id="detailsview1" runat="server" autogeneraterows="false" datakeynames="title_id" datasourceid="sqldatasource1" oniteminserted="detailview_iteminsert" onitemcommand="detailview_itemcommand" defaultmode="insert" height="50px" width="364px" > <fields> <asp:boundfield datafield="title" headertext="title" sortexpression="title" /> <asp:templatefield headertext="price"> <edititemtemplate> <asp:textbox id="price" runat="server" text='<%# bind("price") %>' /> <br /> <asp:requiredfieldvalidator id="requiredfieldvalidator1" runat="server" controltovalidate="price" errormessage="requiredfieldvalidator"></asp:requiredfieldvalidator> <br /> </edititemtemplate> </asp:templatefield> <asp:templatefield headertext="publish date"> <edititemtemplate > <asp:textbox id="pub_date" runat="server" text='<%# bind("pubdate") %>' /> </edititemtemplate> </asp:templatefield> <asp:boundfield datafield="notes" headertext="notes" sortexpression="notes" /> <asp:commandfield showinsertbutton="true" /> </fields> </asp:detailsview> <asp:sqldatasource id="sqldatasource1" runat="server" connectionstring="<%$ connectionstrings:mybookstoreconnectionstring1 %>" deletecommand="delete [titles] [title_id] = @title_id" insertcommand="insert [titles] ([pub_id], [au_id], [title], [price], [pubdate], [notes]) values (@pub_id, @au_id, @title, @price, @pubdate, @notes)" providername="<%$ connectionstrings:mybookstoreconnectionstring1.providername %>" selectcommand="select [title_id], [pub_id], [au_id], [title], [price], [pubdate], [notes] [titles]" updatecommand="update [titles] set [pub_id] = @pub_id, [au_id] = @au_id, [title] = @title, [price] = @price, [pubdate] = @pubdate, [notes] = @notes [title_id] = @title_id"> <deleteparameters> <asp:parameter name="title_id" type="int32" /> </deleteparameters> <insertparameters> <asp:parameter name="pub_id" type="int32" /> <asp:parameter name="au_id" type="int32" /> <asp:parameter name="title" type="string" /> <asp:parameter name="price" type="decimal" /> <asp:parameter name="pubdate" type="datetime" /> <asp:parameter name="notes" type="string" /> </insertparameters> <updateparameters> <asp:parameter name="pub_id" type="int32" /> <asp:parameter name="au_id" type="int32" /> <asp:parameter name="title" type="string" /> <asp:parameter name="price" type="decimal" /> <asp:parameter name="pubdate" type="datetime" /> <asp:parameter name="notes" type="string" /> <asp:parameter name="title_id" type="int32" /> </updateparameters> </asp:sqldatasource> </div> </form> </body> </html>
check if web.config has following set properly:
<appsettings> <add key="validationsettings:unobtrusivevalidationmode" value="none" /> </appsettings>
Comments
Post a Comment