Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > TextBox Validation Inside a Repeater

Reply
Thread Tools

TextBox Validation Inside a Repeater

 
 
=?Utf-8?B?QnJ5YW4=?=
Guest
Posts: n/a
 
      08-20-2004
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


 
Reply With Quote
 
 
 
 
Karl
Guest
Posts: n/a
 
      08-20-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
get value from asp:textbox inside Repeater datakix@gmail.com ASP .Net 2 08-08-2011 12:01 PM
repeater inside a repeater problem. uncensored ASP .Net 0 10-25-2006 06:10 PM
Repeater inside a Repeater Microsoft ASP .Net Web Controls 0 08-21-2006 09:13 AM
Repeater inside a repeater....how? voidfill3d@yahoo.com ASP .Net 1 08-10-2005 01:58 PM
Textbox inside a repeater. how to access datarow in post back event. guoqi zheng ASP .Net 1 06-10-2005 11:59 AM



Advertisments