ASP.net RequiredFieldValidator VisualStudio 2012

后端 未结 3 1148
不知归路
不知归路 2021-02-04 18:40

I am developing a project with ASP.net c#. I want RequiredFieldValidator to check my textbox. I am adding validator, and it works perfectly fine in Visual Studio 2010. But once

相关标签:
3条回答
  • 2021-02-04 19:19
    <appSettings>
        <add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/>
    </appSettings>
    

    never use jquery script it will go to server end every time which give bad effect to your application perfomance just add tag(mention above) in web config

    within configuration tag

    0 讨论(0)
  • 2021-02-04 19:29
    protected void Page_Load(object sender, EventArgs e)
    {
        this.UnobtrusiveValidationMode =System.Web.UI.UnobtrusiveValidationMode.None;
    }
    

    Just copy & paste in C# Code

    0 讨论(0)
  • 2021-02-04 19:32

    See here

    It looks like you have to either remove this line:

    <appSettings>
        <add key="ValidationSettings:UnobtrusiveValidationMode" value="WebForms" />
    </appSettings>
    

    Or change it to this:

    <appSettings>
        <add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/>
    </appSettings>
    

    Which will disable it for you.

    Alternatively you could add something like this to your Global.asax

    ScriptManager.ScriptResourceMapping.AddDefinition("jquery", new ScriptResourceDefinition {
         Path = "~/scripts/jquery-1.4.1.min.js",
         DebugPath = "~/scripts/jquery-1.4.1.js",
         CdnPath = "http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.1.min.js",
         CdnDebugPath = "http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.1.js"
    });
    

    Hopefully this gets you squared away!

    0 讨论(0)
提交回复
热议问题