G
Guest
I trying to figure out out to validate a textbox inside a repeater once a
person presses a button on a repeater.
Here's the validation Code behind:
Please be aware that line e.Item.ItemIndex is invalid. Because I don't know
how to pass the repeater as the object through the OnServerValidate Tag in
the ASP.NET side. What I really need is to pull the ItemIndex from the
actual repeater.
Sub ValidQtyValidation(ByVal source As Object, ByVal args As
ServerValidateEventArgs)
'Counts the rows of the collection
Dim i As Integer
'Get the the row of the repeater that the button was pushed
i = e.Item.ItemIndex
'Grabs the information out the text box dependent on the index
number in the repeater
txtbox = CType(rptItemDescription.Items(i).FindControl("txtQty"),
TextBox)
'Validation check
If IsNumeric(txtbox.Text) = False Then
args.IsValid = False
Else
args.IsValid = True
End If
End Sub
person presses a button on a repeater.
Here's the validation Code behind:
Please be aware that line e.Item.ItemIndex is invalid. Because I don't know
how to pass the repeater as the object through the OnServerValidate Tag in
the ASP.NET side. What I really need is to pull the ItemIndex from the
actual repeater.
Sub ValidQtyValidation(ByVal source As Object, ByVal args As
ServerValidateEventArgs)
'Counts the rows of the collection
Dim i As Integer
'Get the the row of the repeater that the button was pushed
i = e.Item.ItemIndex
'Grabs the information out the text box dependent on the index
number in the repeater
txtbox = CType(rptItemDescription.Items(i).FindControl("txtQty"),
TextBox)
'Validation check
If IsNumeric(txtbox.Text) = False Then
args.IsValid = False
Else
args.IsValid = True
End If
End Sub