How
to use Validation in Asp.Net with IDE Visual Studio 2012....................
Note: When we will apply validation on WebPages in
Asp.Net with Visual Studio 2010 IDE or earlier version like (2008,2005)
there is no problem with to validation , but with Visual Studio 2012,13 IDE , there occurs
some errors with validation, the error
is being …..
Server Error in '/' Application.
WebForms
UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please
add a ScriptResourceMapping named jquery(case-sensitive).
The solution to the
problem is to make some changes in Web.Config
which I have provided as follows….
<?xml version="1.0"?>
<!--
For more information on how to configure your
ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<!--some
change with web.config -->
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode"
value="None"/>
</appSettings>
<!--end-->
<system.web>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
</system.web>
</configuration>
Code for Default.aspx…………………………………….
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style1">
<tr>
<td colspan="2"><span style="color:red;text-align:left"><i>How to use Validation in Asp.Net with IDE Visual Studio 2012</i></span></td>
</tr>
<tr>
<td>Name</td>
<td>
<asp:TextBox ID="txtname" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtname" ErrorMessage="Please enter
name"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td> </td>
<td>
<asp:Button ID="btncheckValidation" runat="server" Text="Check
Validation"
/>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
Result
0 comments:
Post a Comment