In my repter there are textboxes and buttosn, what I am facing that if one of my button click it show in all row to fill the textboxs .
So i have to do dynmic so it only validate that row in which button is click.In this Shop_Product_id is my unique id you can place your own unique id
<asp:Repeater id="rptProducts" runat="server">
<ItemTemplate>
<asp:TextBox ID="txtVoucherCode" runat="server" ValidationGroup = '<%# "Group_" + Eval("Shop_Product_id").ToString()%>'></asp:TextBox>
<asp:Button ID="btnUpdateSkillVoucher" Text="UpdateVoucher" ValidationGroup = '<%# "Group_" + Eval("Shop_Product_id").ToString()%>' CssClass="button" runat="server" />
<asp:RequiredFieldValidator runat="server" ID="rqfl" ErrorMessage="Skill Voucher Code Required!" ValidationGroup = '<%# "Group_" + Eval("Shop_Product_id").ToString() %>' ControlToValidate="txtVoucherCode" SetFocusOnError="True"> </asp:RequiredFieldValidator>
</ItemTemplate>
</asp:Repeater>
https://www.aspsnippets.com/Articles/Validate-only-certain-selected-GridView-Row-Controls-like-TextBox-using-ASPNet-Validators.aspx
No comments:
Post a Comment