TextBox Validation Inside a Repeater

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
 
K

Karl

can't you just use args.value to get the textbox value? assuming you set the
controltovalidate properly..should be go..

args.IsValid = IsNumeric(args.Value)

Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top