Asp.NET Validation Kullanırken UnobtrusiveValidationMode Hatası
Alternatif çözümü gerçekleştirebilmek için projenize Global.asax dosyasını eklemeniz gerekmektedir.Aşağıda bir Asp.NET projesine eklenmiş Global.asax dosyasının saf içeriği bulunmaktadır.
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
}
protected void Session_Start(object sender, EventArgs e)
{
}
protected void Application_BeginRequest(object sender, EventArgs e)
{
}
protected void Application_AuthenticateRequest(object sender, EventArgs e)
{
}
protected void Application_Error(object sender, EventArgs e)
{
}
protected void Session_End(object sender, EventArgs e)
{
}
protected void Application_End(object sender, EventArgs e)
{
}
}
Bu dosyanın içinde gördüğünüz gibi “Application_Start” isimli bir metod bulunmaktadır.Bu metodun içine aşağıdaki kodları yerleştirmemiz yeterli olacaktır.
protected void Application_Start(object sender, EventArgs e)
{
ScriptManager.ScriptResourceMapping.AddDefinition("jquery", new ScriptResourceDefinition
{
Path = "http://code.jquery.com/jquery-1.10.2.min.js",
DebugPath = "http://code.jquery.com/jquery-1.10.2.min.js",
CdnPath = "http://code.jquery.com/jquery-1.10.2.min.js",
CdnDebugPath = "http://code.jquery.com/jquery-1.10.2.min.js"
});
}
http://code.jquery.com/jquery-1.10.2.min.js linkinden JQuery dosyasını indirip projenizde attığınız dizinide gösterebilirsiniz.Bu alternatif çözümde JQuery ile hataya çözüm bulmuş oluyoruz.
İyi çalışmalar diliyorum…
