how to add multiple checkbox in single item template inside gridview on row data bound

Ankit tewari
Ankit t...
112 Points
11 Posts

I am working in room booking  page according bed wise . i am getting value inside grid view on item template  field from database is 

if  1 bed then (1)
if  2 bed then (1,1)
if  5 bed then (1,1,1,1,1)

aspx code is

<asp:TemplateField HeaderText="Bed Status">
<ItemStyle HorizontalAlign="Center" />
  <ItemTemplate>
    <asp:CheckBox ID="chknoofbeds" runat="server" />
    <asp:Label ID="lblnoofbeds" runat="server" Text='<%# Eval("No_of_beds") %>'  visible ="false">
  </asp:Label>
</ItemTemplate>
</asp:TemplateField>

Now how  i can add multiple checkbox in single template  on row databound. according this value (1),(1,1),(1,1,1,1)..etc

Views: 9713
Total Answered: 1
Total Marked As Answer: 0
Posted On: 07-Feb-2019 23:57

Share:   fb twitter linkedin
Use checkboxlist instead of checkbox inside itemtemplate
 - Rahul Maurya  08-Feb-2019 05:02
Answers
Rahul Maurya
Rahul M...
4916 Points
27 Posts
         

Use following as reference

https://www.c-sharpcorner.com/blogs/checkboxlist-within-gridview-cell-count-all-selected-items1

https://forums.asp.net/t/1955767.aspx?using+Checkboxlist+in+gridview+ASP+Net

https://www.aspsnippets.com/Articles/Implement-Mutually-Exclusive-CheckBoxList-CheckBoxes-inside-GridView-in-ASPNet.aspx

Posted On: 08-Feb-2019 05:16
 Log In to Chat