By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,121 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Required field validator static text does not display

P: n/a
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.
I also have a summary validator control.

A sample :-

<asp:textbox id="txtSurname" Runat="server"
MaxLength="50"></asp:textbox>
<asp:requiredfieldvalidator display="static" id="valSurname"
Runat="server" Visible="True" ControlToValidate="txtSurname"
ErrorMessage="Surname must be entered.">*</asp:requiredfieldvalidator>

Thanks Milan
Nov 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a

"Milan" <ms****@hotmail.com> wrote in message news:8e**************************@posting.google.c om...
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.
I also have a summary validator control.


Sorry, the validator doesn't work this way.
Both "Text" and "ErrorMessage" are only shown after an error-check
(on submit for instance). If you have a validation summary, then the
"ErrorMessage" is shown in that summary, the "Text" is always shown
on the position of the validator.

Hans Kesting
Nov 18 '05 #2

P: n/a
Hi,
The purpose of Display property is something else. If you set it to static,
it indicates that space should be reserved for error messages in the page
flow layout on the browser window; it does not mean validator control error
msgs should be displayed on page load itself.

One option to show the '*' on initial page display itself is to call the
page's Validate() method in the page load event.

Hoep this helps.

"Milan" <ms****@hotmail.com> wrote in message
news:8e**************************@posting.google.c om...
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.
I also have a summary validator control.

A sample :-

<asp:textbox id="txtSurname" Runat="server"
MaxLength="50"></asp:textbox>
<asp:requiredfieldvalidator display="static" id="valSurname"
Runat="server" Visible="True" ControlToValidate="txtSurname"
ErrorMessage="Surname must be entered.">*</asp:requiredfieldvalidator>

Thanks Milan
Nov 18 '05 #3

P: n/a
Okay. you're looking at 2 different things. The First is the Asterisk that
should always be displayed, which is really just a visual decoration for the
textbox, and then there's the validation control, which is a behavior.

Take the Asterisk out of the validation control totally. The next to the
text box, type an asterisk and format it whatever way you want.

"Milan" <ms****@hotmail.com> wrote in message
news:8e**************************@posting.google.c om...
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.
I also have a summary validator control.

A sample :-

<asp:textbox id="txtSurname" Runat="server"
MaxLength="50"></asp:textbox>
<asp:requiredfieldvalidator display="static" id="valSurname"
Runat="server" Visible="True" ControlToValidate="txtSurname"
ErrorMessage="Surname must be entered.">*</asp:requiredfieldvalidator>

Thanks Milan

Nov 18 '05 #4

P: n/a
Hi,
Thanks for clarifying how the validators work. I tried the page.validate on
page load and it partially does the trick, but other error messages show up
in the summary.

I will use the obvious method of displaying the asterisks as mentioned by
David.
Milan
"David Jessee" wrote:
Okay. you're looking at 2 different things. The First is the Asterisk that
should always be displayed, which is really just a visual decoration for the
textbox, and then there's the validation control, which is a behavior.

Take the Asterisk out of the validation control totally. The next to the
text box, type an asterisk and format it whatever way you want.

"Milan" <ms****@hotmail.com> wrote in message
news:8e**************************@posting.google.c om...
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.
I also have a summary validator control.

A sample :-

<asp:textbox id="txtSurname" Runat="server"
MaxLength="50"></asp:textbox>
<asp:requiredfieldvalidator display="static" id="valSurname"
Runat="server" Visible="True" ControlToValidate="txtSurname"
ErrorMessage="Surname must be entered.">*</asp:requiredfieldvalidator>

Thanks Milan


Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.