|
-
Dec 1st, 2003, 03:55 AM
#1
Thread Starter
Junior Member
RequiredValidator ?
<asp:TextBox id="TextBox_search" runat="server"></asp:TextBox>
<asp:TextBox id="TextBox_subscribe" runat="server"></asp:TextBox>
<asp:Button id="Button_search" runat="server" Text="Search"></asp:Button>
<asp:Button id="Button_submit" runat="server" Text="Submit"></asp:Button>
<asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ErrorMessage="Email must not left blank" ControlToValidate="TextBox_subscribe"></asp:RequiredFieldValidator>
========================================
I had 2 buttons with different purpose, but when I pressed the search button for textbox_search(in empty) which I never validate to it, message error on textbox_subscribe came out "email must not left blank".
So how to make RequiredFieldValidator only work with Button_submit not Button_search ?
Thanks in advance.
Last edited by Rio; Dec 4th, 2003 at 11:07 AM.
-
Dec 1st, 2003, 06:04 AM
#2
Thread Starter
Junior Member
With the first scenario maybe we can use cause validation property.
But how if the second scenario like this, each textbox have their own validator and must independent, so if we press search button(in empty field) only 'Search Query Required' message appear ???
=====================================
<asp:TextBox id="TextBox_search" runat="server"></asp:TextBox>
<asp:TextBox id="TextBox_subscribe" runat="server"></asp:TextBox>
<asp:Button id="Button_search" runat="server" Text="Search"></asp:Button>
<asp:Button id="Button_submit" runat="server" Text="Submit"></asp:Button>
<asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox_subscribe" ErrorMessage="Email Required" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server" Display="Dynamic" ErrorMessage="Search Query Required" ControlToValidate="TextBox_search"></asp:RequiredFieldValidator>
=====================================
Thanks again..
Sorry I am just a beginner.., still need help
Last edited by Rio; Dec 4th, 2003 at 11:12 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|