C
Christina
Hello !!
I am creating a dynamic textbox and want to validate it using the
requiredfieldvalidator.
These are the steps which I tried:
====================================================
1) In Page_load,
Dim Email As New Label
Email.Text = "* Email Address"
placeHolder1.Controls.Add(Email)
Dim txtEmailAddress As New TextBox
placeHolder2.Controls.Add(txtEmailAddress )
2) The HTML has:
<tr><td>
<asplaceHolder ID="placeHolder1" Runat="server"></asplaceHolder>
<asp:requiredfieldvalidator id="reqFieldVal1" runat="server"
Display="Dynamic" ErrorMessage="Required"
ControlToValidate="txtEmailAddress"></asp:requiredfieldvalidator>
</td>
</tr>
====================================================
This gives an error message :
Unable to find control id 'txtEmailAddress' referenced by the
'ControlToValidate' property of 'reqFieldVal1'.
I tried the following options, but was unsuccessful:
a) Move requiredFieldValidator inside placeholder. (Googling around,
suggested that the validator and control should be in the same
container)
b) Tried to create requiredFieldValidator dynamically and add it in the
same placeholder (ie placeHolder1)
Any pointers will be appreciated !!
TIA..
I am creating a dynamic textbox and want to validate it using the
requiredfieldvalidator.
These are the steps which I tried:
====================================================
1) In Page_load,
Dim Email As New Label
Email.Text = "* Email Address"
placeHolder1.Controls.Add(Email)
Dim txtEmailAddress As New TextBox
placeHolder2.Controls.Add(txtEmailAddress )
2) The HTML has:
<tr><td>
<asplaceHolder ID="placeHolder1" Runat="server"></asplaceHolder>
<asp:requiredfieldvalidator id="reqFieldVal1" runat="server"
Display="Dynamic" ErrorMessage="Required"
ControlToValidate="txtEmailAddress"></asp:requiredfieldvalidator>
</td>
</tr>
====================================================
This gives an error message :
Unable to find control id 'txtEmailAddress' referenced by the
'ControlToValidate' property of 'reqFieldVal1'.
I tried the following options, but was unsuccessful:
a) Move requiredFieldValidator inside placeholder. (Googling around,
suggested that the validator and control should be in the same
container)
b) Tried to create requiredFieldValidator dynamically and add it in the
same placeholder (ie placeHolder1)
Any pointers will be appreciated !!
TIA..