BHARATH
BHARATH

Reputation: 85

set multiple Validator for single textbox

i am new to asp.net and facing some small small problem in it and the problem is to set the multiple validator for a single Textbox. I set the validation but while running it, the validation takes step-by-step, not in a single place.

Here's my code:

<td align="right" style="padding-right: 5px; width: 50%;">
    <asp:Label ID="lblConformPassword" runat="server" Text="CONFORMPASSWORD &nbsp;:"></asp:Label>
</td>
<td align="left" style="padding-left: 5px; width: 50%; color: #FF0000;">
    <br />
    <br />
    <br />
    <asp:TextBox ID="txtConformPassword" runat="server" TextMode="Password" Width="70%"
        ForeColor="red" AutoCompleteType="Office"></asp:TextBox>
    * &nbsp;&nbsp;&nbsp;<br />
    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtConformPassword"
        ErrorMessage="You can't leave this empty." Style="color: #FF0000;"></asp:RequiredFieldValidator>
    <br />
    <asp:RegularExpressionValidator ID="rfvConformPassword" runat="server" ControlToValidate="txtConformPassword"
        ErrorMessage="SEE THE NOTE" ValidationExpression="(?=^.{6,}$)(?=.*\d)(?=.*\W+)(?![.\n]).*$"></asp:RegularExpressionValidator>
    <br />
    <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="txtpassword"
        ControlToValidate="txtconformpassword" ErrorMessage="Password And ConformPassword Should Be Same."
        Display="Dynamic" Style="color: #FF0000; margin-left: 0px"></asp:CompareValidator>
    <br />
</td>

All of the validation should take place in single line. How can set I it? Can any one help me on this process?

Upvotes: 0

Views: 5567

Answers (2)

Saiyam
Saiyam

Reputation: 138

Use Display="dynamic" property of validators. hope this helps!!

Upvotes: 1

Darshan
Darshan

Reputation: 535

ok..I guess there is one property in all this validator Display="dynamic" You can try that.and you can take div structure instead of
.also you have to put display=dynamic in all validators Thanks

Upvotes: 5

Related Questions