|
-
July 19th, 2005, 11:29 AM
#1
Dynamic control validation problems
I have a table with text boxes that i generate dynamically. I need to add some validation control to these text boxes.
Can anyone tell me where to put the validation code.
My code to generate the table is :
<code>
private sub create entry fields(num as integer)
Dim j As Integer
Dim no As Integer = CInt(noOfPermitee)
For j = 0 To num - 1
Dim tr As New TableRow
Dim td1 As New TableCell
Dim txt1 As New TextBox
txt1.TextMode = TextBoxMode.MultiLine
td1.Controls.Add(txt1)
Dim td2 As New TableCell
Dim txt2 As New TextBox
txt2.TextMode = TextBoxMode.MultiLine
td2.Controls.Add(txt2)
tblUserInputs.Rows.Add(tr)
Next
End sub
</code>
I call this sub in a button click event.
I am able to write the required field validator. I just don't know where to write the validation code.
My validation code is:
Dim reqval1 As New RequiredFieldValidator
reqval1.ControlToValidate = "txt1"
reqval1.ErrorMessage = "*"
reqval1.Text = "Please enter the agent name
Where should i put this code for the validation to fire.
Thank you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|