I am genetrating validators Dynamically but gettin an
err
Object reference not set to an instance of an
object.Can ne1 correct me.
For Cntr = 1 To CInt(noOfChoices)
Dim tr As New TableRow()
Dim tc As New TableCell()
Dim txt As New TextBox()
txt.ID = "Text" & CStr(Cntr)
txt.Text = Request("Text" &
CStr(Cntr))
Dim txtValid As
RequiredFieldValidator
txtValid.ControlToValidate =
txt.ID ***here Object reference not set to an
instance of an object
txtValid.ErrorMessage =
"Fields Cannot be Blank"
txtValid.Display =
ValidatorDisplay.Dynamic
tc.Text = " Choice" & Cntr & "
: "
tc.Font.Name = "Verdana"
tc.Font.Size = New
System.Web.UI.WebControls.FontUnit(10)
tr.Cells.Add(tc)
tc = New TableCell()
tc.Controls.Add(txt)
tr.Cells.Add(tc)
dynTable1.Rows.Add(tr)
Next