Topic: Checkbox not working inside asp:Gridview Item templete

Sunny Sharma free asked 6 years ago


Hello Sir, I have just added checkbox inside grid view but the check function over label not working. Here is the HTML.
<div class="card"> <div class="card-block"> <asp:GridView ID="GVdata" CssClass="table-sm table-hover table-responsive" Width="100%" AutoGenerateColumns="false" GridLines="Horizontal" DataKeyNames="participantID" Font-Size="Small" runat="server" Font-Bold="true"> <Columns> <asp:TemplateField HeaderStyle-CssClass="headercenter" ItemStyle-Height="50px" HeaderText="Select"> <ItemTemplate> <input type="checkbox" runat="server" id="chkRow"/> <label id="test" for="chkRow" ></label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderStyle-CssClass="headercenter" HeaderText="Send"> <ItemTemplate> <asp:LinkButton ID="btnsend" runat="server" OnClick="btnSendMail_Click" class="icons-sm fb-ic"><i class="fa fa-envelope"></i></asp:LinkButton> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderStyle-CssClass="headercenter" HeaderText="email"> <ItemTemplate> <asp:Label ID="lblemail" Text='<%# Eval("Email")%>' runat="server"></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderStyle-CssClass="hiddencol" ItemStyle-CssClass="hiddencol"> <ItemTemplate> <asp:Label ID="lblpid" Text='<%# Eval("participantID")%>' runat="server"></asp:Label> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> <div class="mdb-form"> <asp:Button ID="btnbulkmailsend" runat="server" CssClass="btn btn-md btn-success" Text="Send Bulk Mail" ValidationGroup="reg" OnClick="btnSendMail_Click" /> </div> </div> </div>
the gridview is binding from sql database. i want ti send the email to the email column based on checked checkbox. Kindly help me for this..

I noticed that the label is empty. Take a look at this:
<input type="checkbox" runat="server" id="chkRow"/>
<label id="test" for="chkRow" ></label>
Your label is empty, but when you add some text to label it will work

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Specification of the issue

  • User: Free
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags