hey
asp.net 2.0
I'm trying to create a web page where users can register to my web portal.
But I've run into a layout problem when using the data validator classes.
The problem is that the error message is not displayed on the same row as
the control it's validating. Check this link and you see an example of the
problem: http://home.online.no/~au-holme/pub/14506/problem.GIF the text
"Password and confirm password must match" is not displayed on the same row
as the control it is set to validate. And also the error isn't left
aligned, but HorizontalAlign is set to "Left" - so I hoped the text should
be left aligned
What am I doing wrong here?
Below are the markup of my problem table
<asp:Table ID="Table1" runat="server" CellPadding="2" Width="100%"
BorderStyle="So lid" BorderColor="Gr een" BorderWidth="2" >
<asp:TableRow >
<asp:TableCel l CssClass="field name"
Width="180">Use rName:</asp:TableCell>
<asp:TableCel l Width="200" ><asp:TextBox ID="UserName" runat="server"
Width="200" /></asp:TableCell>
<asp:TableCel l HorizontalAlign ="Left" Width="220px">
<asp:RequiredFi eldValidator ID="valRequireU serName" runat="server"
ControlToValida te="UserName" SetFocusOnError ="true" Display="Dynami c"
ErrorMessage="U sername is required." ToolTip="Userna me is required."
ValidationGroup ="CreateUserWiz ard1">*</asp:RequiredFie ldValidator>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow >
<asp:TableCel l CssClass="field name" Width="180" BorderStyle="So lid"
BorderColor="Bl ueViolet" BorderWidth="2" >Password:</asp:TableCell>
<asp:TableCel l Width="200" BorderStyle="So lid" BorderWidth="2"
BorderColor="Da rkRed"><asp:Tex tBox ID="Password" runat="server"
TextMode="Passw ord" Width="200" /></asp:TableCell>
<asp:TableCel l HorizontalAlign ="Left" Width="220px">
<asp:RequiredFi eldValidator ID="valRequired Password" runat="server"
ErrorMessage="P assword is required" ValidationGroup ="CreateUserWiz ard1"
ControlToValida te="password"> </asp:RequiredFie ldValidator>
<%--<asp:RegularExp ressionValidato r ID="valPassword Length" runat="server"
ErrorMessage="P assword too short" Display="Dynami c"
ValidationGroup ="CreateUserWiz ard1" ControlToValida te="Password"
ValidationExpre ssion="\w{5,}"> </asp:RegularExpr essionValidator >--%>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow >
<asp:TableCel l CssClass="field name" Width="180">Con firm
password:</asp:TableCell>
<asp:TableCel l Width="200" BorderStyle="So lid" BorderColor="Ca detBlue"
BorderWidth="2" ><asp:TextBox ID="Confirmpass word" runat="server"
TextMode="Passw ord" Width="200" /></asp:TableCell>
<asp:TableCel l HorizontalAlign ="Left" Width="220px" BorderStyle="So lid"
BorderColor="Be ige" BorderWidth="2" >
<asp:RequiredFi eldValidator ID="valRequired ConfirmPassword " runat="server"
ErrorMessage="C onfirm password is required"
ControlToValida te="Confirmpass word"
ValidationGroup ="CreateUserWiz ard1"></asp:RequiredFie ldValidator>
<asp:CompareVal idator ID="valCompareP asswords" runat="server"
ErrorMessage="P assword and confirm password must match"
ValidationGroup ="CreateUserWiz ard1" ControlToCompar e="Password"
SetFocusOnError ="true"
ControlToValida te="Confirmpass word"></asp:CompareVali dator>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow >
<asp:TableCel l CssClass="field name" Width="180" BorderColor="Re d"
BorderStyle="So lid" BorderWidth="2" >E-mail:</asp:TableCell>
<asp:TableCel l Width="200"><as p:TextBox ID="Email" runat="server"
Width="200" /></asp:TableCell>
<asp:TableCel l>
<asp:RequiredFi eldValidator ID="valRequireE mail" runat="server"
ErrorMessage="E-mail is required" ControlToValida te="Email"
ValidationGroup ="CreateUserWiz ard1"
SetFocusOnError ="true"></asp:RequiredFie ldValidator>
<asp:RegularExp ressionValidato r ID="valEmailPat tern" runat="server"
ErrorMessage="T he E-mail is not well-formed" Display="Dynami c"
ControlToValida te="Email" ValidationGroup ="CreateUserWiz ard1"
ValidationExpre ssion="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpr essionValidator >
</asp:TableCell>
</asp:TableRow>
<asp:TableRow >
<asp:TableCel l CssClass="field name" Width="180">Sec urity
question:</asp:TableCell>
<asp:TableCel l Width="200"><as p:TextBox ID="Question" runat="server"
Width="200" /></asp:TableCell>
<asp:TableCel l>
<asp:RequiredFi eldValidator ID="valRequireQ uestion" runat="server"
ErrorMessage="S ecurity question is required"
ValidationGroup ="CreateUserWiz ard1" ControlToValida te="Question"
SetFocusOnError ="true" Display="Dynami c"></asp:RequiredFie ldValidator>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow >
<asp:TableCel l CssClass="field name" Width="180" BorderColor="Br own"
BorderStyle="So lid" BorderWidth="2" >Security answer:</asp:TableCell>
<asp:TableCel l Width="200"><as p:TextBox ID="Answer" runat="server"
Width="200" /></asp:TableCell>
<asp:TableCel l>
<asp:RequiredFi eldValidator ID="valRequireA nswar" runat="server"
ErrorMessage="S ecurity answer is required" Display="Dynami c"
SetFocusOnError ="true" ValidationGroup ="CreateUserWiz ard1"
ControlToValida te="Answer"></asp:RequiredFie ldValidator>
</asp:TableCell>
</asp:TableRow>
</asp:Table>