473,387 Members | 1,899 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,387 software developers and data experts.

Validator within a Repeater problem

I have a textbox and a button within a repeater. The
OnItemCommand sub of the repeater looks like this:

Sub RepeaterButtonSub(ByVal source As Object, ByVal e
As RepeaterCommandEventArgs)
Dim RejectTxt As TextBox =
CType(e.Item.FindControl("txtRejectNote"), TextBox)
RejectButton(New
Guid(e.CommandArgument.ToString), RejectTxt.Text)
End Sub

Note that even though the textbox within each repeateritem
are named the same ("txtRejectNote"), the sub gets the
correct one, I assume because FindControl is limited to
searching for controls within the specific repeateritem.
Now I want to add a RequiredFieldValidator for the textbox.
I set the ControlToValidate to "txtRejectNote", but
instead of validating just the textbox within the
repeateritem in which I clicked the button, it validates
all the textboxes in all the repeateritems (since they all
have the same ID). Is this a bug? Is there any way to
make it validate only the textbox that's in the same
repeateritem as the button? Thanks.
Nov 18 '05 #1
2 3231
ASP.Net validator controls are all or nothing. ASP.Net 2.0 solves this
problem. In the interim there are a number of 3rd party components, such
as: http://www.peterblum.com/vam/home.aspx

That's just one I found by searching, I don't think it's free, but you
should be able to find one. Search for grouped validator controls or
something similar.

Karl
"Jerrad" <je*****@oslc.org> wrote in message
news:2f****************************@phx.gbl...
I have a textbox and a button within a repeater. The
OnItemCommand sub of the repeater looks like this:

Sub RepeaterButtonSub(ByVal source As Object, ByVal e
As RepeaterCommandEventArgs)
Dim RejectTxt As TextBox =
CType(e.Item.FindControl("txtRejectNote"), TextBox)
RejectButton(New
Guid(e.CommandArgument.ToString), RejectTxt.Text)
End Sub

Note that even though the textbox within each repeateritem
are named the same ("txtRejectNote"), the sub gets the
correct one, I assume because FindControl is limited to
searching for controls within the specific repeateritem.
Now I want to add a RequiredFieldValidator for the textbox.
I set the ControlToValidate to "txtRejectNote", but
instead of validating just the textbox within the
repeateritem in which I clicked the button, it validates
all the textboxes in all the repeateritems (since they all
have the same ID). Is this a bug? Is there any way to
make it validate only the textbox that's in the same
repeateritem as the button? Thanks.

Nov 18 '05 #2
That stinks. I've even tried assigning each textbox a
unique ID in the repeater's ItemDataBound event and then
assigning that unique ID to the validator's
ControlToValidate property, but that didn't work either.
-----Original Message-----
ASP.Net validator controls are all or nothing. ASP.Net 2.0 solves thisproblem. In the interim there are a number of 3rd party components, suchas: http://www.peterblum.com/vam/home.aspx

That's just one I found by searching, I don't think it's free, but youshould be able to find one. Search for grouped validator controls orsomething similar.

Karl
"Jerrad" <je*****@oslc.org> wrote in message
news:2f****************************@phx.gbl...
I have a textbox and a button within a repeater. The
OnItemCommand sub of the repeater looks like this:

Sub RepeaterButtonSub(ByVal source As Object, ByVal e
As RepeaterCommandEventArgs)
Dim RejectTxt As TextBox =
CType(e.Item.FindControl("txtRejectNote"), TextBox)
RejectButton(New
Guid(e.CommandArgument.ToString), RejectTxt.Text)
End Sub

Note that even though the textbox within each repeateritem
are named the same ("txtRejectNote"), the sub gets the
correct one, I assume because FindControl is limited to
searching for controls within the specific repeateritem.
Now I want to add a RequiredFieldValidator for the textbox.
I set the ControlToValidate to "txtRejectNote", but
instead of validating just the textbox within the
repeateritem in which I clicked the button, it validates
all the textboxes in all the repeateritems (since they all
have the same ID). Is this a bug? Is there any way to
make it validate only the textbox that's in the same
repeateritem as the button? Thanks.

.

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: RA | last post by:
Hi How do I disable it if the user pressed a button: asp:imagebutton id="btnHome" onclick="test()" runat="server" What I want to have is that if someone presses this button then the required...
2
by: Jorge Ayala | last post by:
Well I'm trying to catch and act upon a button event that is placed within the item template of a repeater control. Yet the code I'm using isn't working. What I've seen out there to explain how...
4
by: jjack100 | last post by:
I have a DropDownList that is nested inside a Repeater. The datasource of the DropDownList is declared in the aspx, not the codebehind. So we have this: <asp:Repeater ID="rptOptions"...
2
by: Gary Coutts | last post by:
Hi, This is a newbie question. I am have problem with a Repeater Control that is based on the help files that came with Visual Studio, see below: <p><asp:Repeater ID="myReapter"...
9
by: Jaybuffet | last post by:
my aspx has something like this <asp:Repeater id="Repeater1" runat="server"> <ItemTemplate> <mycontrol:ctl id="ctlId" obj='<%# Container.DataItem %>' showItem="true"/> </ItemTemplate>...
0
by: uncensored | last post by:
Hello everyone, I'm fairly new at .Net and I have a repeater inside a repeater problem. I will attach my code to this message but basically what I am able to tell when I run my page it tells me...
1
by: Jeff | last post by:
hey asp.net 2.0 I'm trying to create a web page where users can register to my web portal. But I've run into a layout problem when using the data validator classes. The problem is that the...
2
by: Hong | last post by:
Hi, I have been scratching my head over this problem for hours, the repeater control I am using would only render the controls specified in HeaderTemplate and FooterTemplate, but the repeater...
1
by: supraracer | last post by:
Can anyone show me an example of a solution to the problem described in this thread? How do I rebind a label in a repeater on a postback? ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.