Asp.net登录控件不起作用

编程入门 行业动态 更新时间:2024-10-28 18:27:30
本文介绍了Asp登录控件不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当我将ASP控件添加到我的页面并运行该网站时,我收到此错误:

WebForms UnobtrusiveValidationMode需要ScriptResourceMapping for 'jQuery的'。请添加一个名为jquery的ScriptResourceMapping(区分大小写)。

有什么问题? 请通知我。 我的尝试:

< pre>< asp:Content ID =Content2ContentPlaceHolderID =ContentPlaceHolder1Runat =Server> < asp:登录ID =Login1runat =server>< / asp:登录> < asp:Button ID =Button1runat =serverText =Button/> < / asp:Content>

解决方案

此问题已在其他论坛上得到解答,因为快速谷歌搜索显示我有这些,并且有多种解决方案。 你需要的是在Applicationo_Start后面的Global.asax代码中执行以下操作:

受保护 void Application_Start( object sender,EventArgs e) { string JQueryVer = 1.7.1; ScriptManager.ScriptResourceMapping.AddDefinition( jquery, new ScriptResourceDefinition { Path = 〜/ Scripts / jquery- + JQueryVer + .min.js, DebugPath = 〜/ Scripts / jquery - + JQueryVer + 。js, CdnPath = ajax.aspnetcdn/ajax/jQuery/jquery- + JQueryVer + .min.js, CdnDebugPath = http://ajax.aspnetcdn。 com / ajax / jQuery / jquery - + JQueryVer + 。js, CdnSupportsSecureConnection = true , LoadSuccessExpression = window.jQuery }); }

您可能想了解更多详情此处

When I add ASP control to my page and run the site I get this error:

WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive).

What is wrong? Please inform me. What I have tried:

<pre><asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:Login ID="Login1" runat="server"></asp:Login> <asp:Button ID="Button1" runat="server" Text="Button" /> </asp:Content>

解决方案

This question is already answered on a different forum as a quick google search revealed me those, and there are multiple solutions to this. what you need is to do following in Global.asax code behind in Applicationo_Start:

protected void Application_Start(object sender, EventArgs e) { string JQueryVer = "1.7.1"; ScriptManager.ScriptResourceMapping.AddDefinition("jquery", new ScriptResourceDefinition { Path = "~/Scripts/jquery-" + JQueryVer + ".min.js", DebugPath = "~/Scripts/jquery-" + JQueryVer + ".js", CdnPath = "ajax.aspnetcdn/ajax/jQuery/jquery-" + JQueryVer + ".min.js", CdnDebugPath = "ajax.aspnetcdn/ajax/jQuery/jquery-" + JQueryVer + ".js", CdnSupportsSecureConnection = true, LoadSuccessExpression = "window.jQuery" }); }

You may want to read more details here

更多推荐

Asp.net登录控件不起作用

本文发布于:2023-11-11 11:16:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1578275.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控件   不起作用   Asp   net

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!