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.
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.