By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,977 Members | 1,136 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,977 IT Pros & Developers. It's quick & easy.

TextBox Validation Inside a Repeater

P: n/a
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("txt Qty"),
TextBox)
'Validation check
If IsNumeric(txtbox.Text) = False Then
args.IsValid = False
Else
args.IsValid = True
End If
End Sub
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
"Bryan" <Br***@discussions.microsoft.com> wrote in message
news:BF**********************************@microsof t.com...
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("txt Qty"),
TextBox)
'Validation check
If IsNumeric(txtbox.Text) = False Then
args.IsValid = False
Else
args.IsValid = True
End If
End Sub

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.