Need to change the Rendered HTML Code for the RequiredFieldValidator

Doh.

wwb_99<-sucks at javascript.

This one

        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtName" Style="display: block;"
            ErrorMessage="Fill me in, please"></asp:RequiredFieldValidator><br />

generates this:

<span id="RequiredFieldValidator1" style="color:Red;display:block;visibility:hidden;">Fill me in, please</span>

I will also check out the control adapter option.

And that gets you a RequiredFieldValidator that takes up space in when “viewed” in the browser and behaves like a block html element.

what Wordbaron wants is this

when the Page is valid


<span id="RequiredFieldValidator1" style="color:Red;[b]display:none[/b];">Fill me in, please</span>

When the Page is invalid


<span id="RequiredFieldValidator1" style="color:Red;[b]display:block[/b];">Fill me in, please</span>

cheers,
rui

In that case, perhaps not the most correct xhtml (not supposed to have block elements inside inline elements, but anyways):

<asp:RequiredFieldValidator ID="val" runat="server" ControlToValidate="txtName" Display="Dynamic"><div>Blah blah blah!</div></asp:RequiredFieldValidator>

Yup!! I think that will do it!! :tup:
SO! SIMPLE!! :stuck_out_tongue:

I guess for the purist you always have:


[left]<asp:RequiredFieldValidator ID="val" runat="server" ControlToValidate="txtName" Display="Dynamic"><span style="display:block">Blah blah blah!</span></asp:RequiredFieldValidator>[/left]