Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validator within a Repeater problem

Status
Not open for further replies.

Jerrycurl

Programmer
Aug 4, 1999
85
US
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top