Validation White Spaces

P

Prince

I have some <RequiredFieldValidator> on my page and
everything works fine except that there are lots of white
spaces between the web server controls that are being
validated. I've set the Display properties for all the
controls to "Dynamic" and still I can't get rid of the
white spaces between controls. It's as if there are
bunch of <br> tags separating the controls.

For example,the "HTML" look similar to this.

Some text here.
<RadioButtonList Server Control>
<RadioButtonList Server Control>
<RadioButtonList Server Control>
<RequireFieldValidator>
<RequireFieldValidator>
<RequireFieldValidator>

Some more text here.
Address: <TextBox Server Control>
<RequireFieldValidator>


When the above "HTML" is displayed in the browser, there
is a large white space between <RadioButtonList Server
Control> and the "Some more text here."

How can I remove all that space and still keep the
validation where it is? Or is this not possible. And if
not, what is the work around?

thanks,
Prince
 
P

Peter Blum

Each time you add an ENTER character into your HTML page, the browser
inserts a little gap of around 3-5 pixels. So you would expect that with 3
ENTER characters separating your invisible validators, there would be a
noticable gap.

Remove the ENTER characters. They are there to make it more human readable
but HTML doesn't need them as it uses <BR> tags to create new lines.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 
P

Prince

Thanks for the reply. I tried removing the ENTER
characters by backspacing until all the validation
controls were on one line. I still see the spaces. How
do I remove the ENTER characters?

Anyway, I viewed the source of the page and saw that
DHTML put <span> </span> tags around each Validation
Control and separated each with a <br>. My guess is that
all those <br> are the cause of the white spaces. Any
thoughts on that?

-- Prince
 
P

Peter Blum

The Microsoft validators do not add a <BR> into the page. They definitely
create <span> tags but those are hidden when Display=Dynamic and the browser
does not let them take up any space. I suspect that your ASP.NET (aspx) form
actually has those <BR> codes in between the validators or they are embedded
in your ErrorMessage string.

Please post a code snippet showing the actual validators from the aspx form
and the HTML output on the page from the same area.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,815
Latest member
treekmostly22

Latest Threads

Top