.net 流氓
天下无难事,有志者成之;天下无易事,有恒者得之。
1 <p>First name
2 <asp:TextBox ID="TextBox1" Runat="server"></asp:TextBox>
3 &nbsp;
4 <asp:RequiredFieldValidator ID="RequiredFieldValidator1"
5 Runat="server" ErrorMessage="You must enter your first name"
6 ControlToValidate="TextBox1"></asp:RequiredFieldValidator>
7  </p>
8  <p>Last name
9 <asp:TextBox ID="TextBox2" Runat="server"></asp:TextBox>
10 &nbsp;
11 <asp:RequiredFieldValidator ID="RequiredFieldValidator2"
12 Runat="server" ErrorMessage="You must enter your last name"
13 ControlToValidate="TextBox2"></asp:RequiredFieldValidator>
14 </p>
15 <p>
16 <asp:Button ID="Button1" OnClick="Button1_Click" Runat="server"
17 Text="Submit"></asp:Button>
18 </p>
19 <p>
20 <asp:ValidationSummary ID="ValidationSummary1" Runat="server"
21 HeaderText="You received the following errors:">
22 </asp:ValidationSummary>
23 </p>
24 <p>
25 <asp:Label ID="Label1" Runat="server"></asp:Label>
26 </p>
1 <asp:RequiredFieldValidator ID="RequiredFieldValidator1"
2 Runat="server" ErrorMessage="You must enter your first name" Text="*"
3 ControlToValidate="TextBox1"></asp:RequiredFieldValidator>
4
5 or
6
7 <asp:RequiredFieldValidator ID="RequiredFieldValidator1"
8 Runat="server" ErrorMessage="You must enter your first name"
9 ControlToValidate="TextBox1">*</asp:RequiredFieldValidator>


这样就不会有重复显示

posted on 2011-06-14 07:10  .net 流氓  阅读(1158)  评论(0编辑  收藏  举报