473,321 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

TextBox Validation Inside a Repeater

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
1 5276
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Pham Nguyen | last post by:
Has anyone seen an example of a textbox server control that has built-in client-side validation? I'd like to build a server control that extends the System.Web.UI.WebControls.TextBox class to allow...
3
by: Kelly Leahy | last post by:
I'm using an Asp:Repeater control with a text box in the item templates. This is for a system that has a number of items that the user can edit and I'd like to generate them based on a list. ...
1
by: MattB | last post by:
OK, never mind my last post. It was easy enough to refer to the table the repeater is bound to, but I made a big, incorrect assumption in that post. In my last post I thought I was successfully...
1
by: Tommy | last post by:
I have a nested repeater. It displays the data correctly, etc.. I have a problem however.. when i iterate through the textboxes in my code all of the values of the text property are empty. I need...
1
by: guoqi zheng | last post by:
Dear sir, I have a textbox inside a repeart control, autopostback set to true for that textbox. When the value of this textbox changes, I need to access current row and update database. ...
4
by: Dave | last post by:
Well... with data in the textbox.. This did not work... <asp:TableCell ID="Tablecell1" CssClass="lnk_results" Runat="server" Width="35%" HorizontalAlign="Left" ColumnSpan="5"> <asp:TextBox...
0
by: datakix | last post by:
After 16 hours of frustration, I've managed to solve this problem for a project I'm working on. The 'trick' is set EnableViewState="False" for the asp:textbox inside the Repeater control. The...
2
by: Andy Fish | last post by:
Hi, I have a forrm with viewstate disabled (to try and optimize network performance). I have come a bit unstuck though when I use a repeater with a textbox inside it Obivously with viewstate...
2
by: Dot Net Work | last post by:
I have a user control that contains a textbox and a link button. This UC sits inside a repeater control. When I click any button, any edited textbox value does not get sent back to the server...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.