все
это моя главная страница
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="OfficeApps.master.cs" Inherits="master1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<link rel="Stylesheet" type="text/css" href="Styles/jquery-ui-1.8.1.custom.css" />
<link rel="Stylesheet" type="text/css" href="Styles/ui.jqgrid.css" />
<link rel="Stylesheet" type="text/css" href="Styles/ui.multiselect.css" />
<script src="JS/jquery.js" type="text/javascript"></script>
<script src="JS/jquery-1.3.1.min.js" type="text/javascript"></script>
<script src="JS/hoverIntent.js" type="text/javascript"></script>
<link href="Styles/MasterStyleSheet.css" rel="stylesheet" type="text/css" />
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="mastertable">
<tr>
<td class="masterheader">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
<div class="logo">
<asp:Image ID="image2" class="logo1" src="Images/OfficeApps.png" runat="server" />
</div>
<div class="menubar">
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
</div>
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td class="mastercontent">
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>
<div class="divbutpos">
<asp:Button ID="Button1" runat="server" Text="LOGOUT" OnClick="Button1_Click" BackColor="#00CCFF"
BorderStyle="None" Font-Bold="True" Font-Names="Verdana" Font-Underline="True"
ForeColor="White" Style="cursor: hand" />
<%-- <asp:ImageButton ID="ImageButton1" CssClass="divbutpos" OnClick="Button1_Click" ImageUrl="~/Images/signout.JPG" runat="server" />--%>
</div>
</td>
</tr>
<tr>
<td class="masterfooter">
<asp:ContentPlaceHolder ID="ContentPlaceHolder3" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
</table>
</div>
причина, по которой я разместил всю свою главную страницу, состоит в том, что в ней есть несколько заполнителей контента в формате таблицы .....
моя страница контента выглядит следующим образом
<%@ Page Title="" Language="C#" MasterPageFile="~/OfficeApps.master" AutoEventWireup="true"
CodeFile="UsersGrid.aspx.cs" Inherits="UsersGrid" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
<div class = "scroll">
<div id="searchbox" title="SearchBox" class="SearchBox">
<div class="SearchBoxHeader">
<h2 style="text-align: center; color: #2E6E9E;">
SEARCH</h2>
</div>
<asp:Label ID="lbl_FilterStatus" runat="server">Status: </asp:Label> <asp:DropDownList
ID="dl_FilterStatus" runat="server">
<asp:ListItem Value="1" Selected="True">Active</asp:ListItem>
<asp:ListItem Value="0">InActive</asp:ListItem>
</asp:DropDownList>
<asp:Label ID="lbl_FilterUname" runat="server">Username: </asp:Label><asp:TextBox
ID="tb_FilterUname" runat="server"></asp:TextBox>
<asp:Label ID="lbl_FilterSname" runat="server">Shortname: </asp:Label><asp:TextBox
ID="tb_FilterSname" runat="server"></asp:TextBox>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="Images/search_icon.gif"
ImageAlign="AbsBottom" OnClientClick="return searchuser();" />
</div>
<table id="usergrid">
</table>
<div id="pager1" style="text-align: center;">
</div>
</div>
<div class="divlblpos">
<asp:Label CssClass="welcomelogo" ID="Label1" runat="server" Text="Welcome"></asp:Label>
<asp:Label ID="Label2" runat="server" CssClass="welcomelogo"></asp:Label>
</div>
<asp:HiddenField ID="Hf_SelectedID" runat="server" />
<div id="dialog" title="UserDetails" style="display: none;">
<table cellspacing="5px" cellpadding="10px">
<tr>
<td>
<asp:Label ID="lbl_usrnm" CssClass="popuptxt" runat="server" Text="UserName"></asp:Label>
</td>
<td>
<asp:TextBox ID="Tb_UserName" Height="15px" Font-Size="13px" runat="server"></asp:TextBox>
</td>
<td>
<asp:Label ID="unameerror" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lbl_name" CssClass="popuptxt" runat="server" Text="Name"></asp:Label>
</td>
<td>
<asp:TextBox ID="Tb_Name" Height="15px" Font-Size="13px" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lbl_shortnm" CssClass="popuptxt" runat="server" Text="ShortName"></asp:Label>
</td>
<td>
<asp:TextBox ID="Tb_SName" Height="15px" Font-Size="13px" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lbl_Admin" CssClass="popuptxt" runat="server" Text="IsAdmin"></asp:Label>
</td>
<td>
<asp:CheckBox ID="Cb_Admin" Checked="false" runat="server" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="lbl_Active" CssClass="popuptxt" runat="server" Text="IsActive"></asp:Label>
</td>
<td>
<asp:CheckBox ID="Cb_Active" Checked="false" runat="server" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="lbl_Email" CssClass="popuptxt" runat="server" Text="Email"></asp:Label>
</td>
<td>
<asp:TextBox ID="Tb_Email" Height="15px" Font-Size="13px" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lbl_phone" CssClass="popuptxt" runat="server" Text="Phone"></asp:Label>
</td>
<td>
<asp:TextBox ID="Tb_Phone" Height="15px" Font-Size="13px" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lbl_mob" CssClass="popuptxt" runat="server" Text="Mobile"></asp:Label>
</td>
<td>
<asp:TextBox ID="Tb_Mobile" Height="15px" Font-Size="13px" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lbl_Depts" CssClass="popuptxt" runat="server" Text="Departments"></asp:Label>
</td>
<td>
<asp:ListBox ID="Lb_Departments" Font-Size="13px" DataTextField="DepartmentName"
Width="154px" DataValueField="DepartmentID" runat="server" SelectionMode="Multiple">
</asp:ListBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lbl_App" CssClass="popuptxt" runat="server" Text="Applications"></asp:Label>
</td>
<td>
<asp:ListBox ID="Lb_Applications" DataTextField="ApplicationName" Font-Size="13px"
Width="154px" DataValueField="ApplicationID" runat="server" SelectionMode="Multiple">
</asp:ListBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lbl_Sup" CssClass="popuptxt" runat="server" Text="Supervisors"></asp:Label>
</td>
<td>
<asp:ListBox ID="Lb_Supervisor" DataTextField="UserName" Font-Size="13px" Width="154px"
DataValueField="UserID" runat="server" SelectionMode="Multiple"></asp:ListBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Lb_Success" Font-Size="10px" runat="server" Text=""></asp:Label>
</td>
<td>
<asp:Button ID="Button_Edit" Width="150px" runat="server" Text="Edit" OnClientClick="return edituser();" />
</td>
</tr>
</table>
</div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder3" runat="Server">
</asp:Content>
Моя проблема заключается в том, что когда мне нужно выполнить проверку с использованием приведенного ниже кода, проверка содержимого не выполняется.
код
<script type="text/javascript">
$.validator.addMethod("regex",function(value, element, regexp)
{
var check = false;
var re = new RegExp(regexp);
return this.optional(element) || re.test(value);
},"<p style='color:red'>*Please check your input</p>");
$(document).ready(function() {
$("#aspnetForm").validate({
rules: {
<%=Tb_UserName.UniqueID %>: {
minlength: 5,
required: true,
regex: "^[a-zA-Z0-9'.\\s\]{3,15}$"
},
<%=Tb_Name.UniqueID %>: {
minlength: 5,
required: true,
regex: "^[a-zA-Z0-9'.\\s\]{3,15}$"
},
<%=Tb_SName.UniqueID %>: {
required: true,
maxlength:4,
regex: "^[a-zA-Z0-9'.\\s\]{1,4}$"
},
<%=Tb_Email.UniqueID %>: {
required: true,
regex:"^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$"
},
<%=Tb_Phone.UniqueID %>: {
minlength: 8,
maxlength: 8,
required: true,
regex:"^[0-9\s]{8}$"
},
<%=Tb_Mobile.UniqueID %>: {
minlength: 10,
maxlength:10,
required: true,
regex:"^[0-9\s]{10}$"
}
},
messages: {
<%=Tb_UserName.UniqueID %>:{
required: "Please Enter your username",
minlength: "User name must be atleast of 5 characters"
},
<%=Tb_Name.UniqueID %>:{
required: "Please Enter your name",
minlength: "name must be atleast of 5 characters"
},
<%=Tb_SName.UniqueID %>:{
required: "Please Enter your shortname",
maxlength:"Shortname cant exceed 4 characters"
},
<%=Tb_Email.UniqueID %>:{
required: "Please Enter email",
},
<%=Tb_Phone.UniqueID %>:{
required: "Please Enter phone",
minlength:"phone number should have 8 digits",
maxlength:"phone number should have 8 digits only"
},
<%=Tb_Mobile.UniqueID %>:{
required: "Please Entermobile number",
minlength: "mobile number should have 10 digits"
maxlength:"mobile number should have 10 digits only"
}
}
});
});
</script>