[thelist] RE: asp.net: Why won't InitialValue work
Timothy Kuhn (CW)
tkuhn-cw at starbucks.com
Wed Dec 22 12:48:34 CST 2004
I think that you need to set the text property in the textbox to the
initial value also. Such as
<asp:textbox id="joined" runat="server" text="enter a value" />
<asp:RequiredFieldValidator initialValue="enter a value" id="rfvJoined"
ControlToValidate="joined"
ErrorMessage="Required: Enter Date: MM-DD-YYYY" Display="Dynamic"
runat="server" />
I didn't have time to test this but I do think it is correct.
------------------------------------------------------------------------
----
If I include InitialValue="MM-DD-YYYY" in the
RegularExpressionValidator,
nothing happens... it's like it's not even there. If I include it in
the
RequiredFieldValidator, it also does not display the initial value, AND
the
validator stops working and allows an empty value. What's with that?
How
can I make this work?
<form runat="server">
<asp:textbox id="joined" runat="server" />
<asp:RegularExpressionValidator id="revJoined"
ControlToValidate="joined"
ErrorMessage="Formt: Enter Date: MM-DD-YYYY" Display="Dynamic"
ValidationExpression="\d{2}-\d{2}-\d{4}" runat="server" />
<asp:RequiredFieldValidator id="rfvJoined" ControlToValidate="joined"
ErrorMessage="Required: Enter Date: MM-DD-YYYY" Display="Dynamic"
runat="server" />
</form>
More information about the thelist
mailing list