473,756 Members | 2,558 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Validator & Layout problem

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>
Nov 9 '06 #1
1 2118
I've solved it, well I had to redesign the layout.
"Jeff" <it************ @hotmail.com.NO SPAMwrote in message
news:ei******** ******@TK2MSFTN GP03.phx.gbl...
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>

Nov 9 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

40
5148
by: Woolly Mittens | last post by:
I was asked to find some documentation which explains how to develop a website using DIV's and CSS, instead of TABLES. This is to explain to the people we outsource things to, how we want it done. I dug around alistapart but couldn't find anything complete enough. I searched through the W3C, but could only find the standards, not how to apply them in the desired way. Does anyone have some handy links for me??? Replying them here might...
72
5439
by: Mel | last post by:
Are we going backwards ? (please excuse my spelling...) In my opinion an absolute YES ! Take a look at what we are doing ! we create TAGS, things like <H1> etc. and although there are tools (dreamweaver and the like), they are all at the lowest level of programming (something like assembly as oposed to C++ etc.). These tools create "brain-dead" developers that constantly have to plough through tons of tags to do the simplest thing. ...
17
4007
by: Colin Cogle | last post by:
------- Line 47, column 8: there is no attribute "id" <DIV id="LeftNavigation" style="position:absolute; left:8px; top:6px; width:200p ------- Line 47, column 31: there is no attribute "style" <DIV id="LeftNavigation" style="position:absolute; left:8px; top:6px; width:200p ------- Line 47, column 127: element "DIV" undefined
39
5684
by: Zak McGregor | last post by:
Hi all Are there any good solutions to aligning form field names and input boxes without resorting to tables? I am struggling to do this nicely at the moment. Thanks Ciao Zak
4
16757
by: Milan | last post by:
Hi, I am having a problem with displaying a * to a required field. There seems to be a problem with this and the static value does not appear unless you submit the page. I am trying to display the static text as soon as the page is loaded in the browser. Does anyone know if there is a bug with the aps.net validator controls? Or is this not possible.
3
1673
by: Angelos Karantzalis | last post by:
Hi guys, I've a small problem with validators. I'm building a single .aspx file that handles all my form posts. I need to be using ASP.NET validators ( or subclasses thereof ), so what i do to overcome the fact that i don't really know what sort of input controls I'm working with is this: 1) I've got the form description in xml, so I know all the fields I'm
7
2619
by: Andrew | last post by:
I've been struggling to achieve the following layout for some time now and I'm not getting anywhere. I've tried several approaches including floats & absolute positioning and none seem to work, primarily due to the footer not being aware of the columns due to me floating / positioning them. I have the following (very simple) markup: <div id="head">...</div> <div id="left">...</div>
11
3053
by: toton | last post by:
Hi, I have little confusion about static memory allocation & dynamic allocation for a cluss member. I have class like class Bar{ public: explicit Bar(){ cout<<"bar default"<<endl; }
0
909
by: | last post by:
I have several textboxes for entering data, and when the user enters a value in one textbox, using the TextChanged event, the other textboxes are calculated with various types of calculations. The problem is if the user enters nonvalid data in the first textbox, the validator callout or compare validator error only displays for a second because the text changed event takes over so the error message disappears. Any idea how I would get...
0
9287
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10046
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9886
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9857
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9722
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8723
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7259
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6542
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2677
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.