Click here to Skip to main content
14,638,900 members
Rate this:
Please Sign up or sign in to vote.
See more:
I want to add checkbox in datagridview.. i tried it from
datagridview(properties)-> Columns -> Here i select DataGridViewCheckBoxColumn

bt when i run the project, i cant checked the checkbox.
project giving any error so i dont know wht to do??
Posted
Rate this:
Please Sign up or sign in to vote.

Solution 1

   
Rate this:
Please Sign up or sign in to vote.

Solution 2

Dear Sumit,

Sometimes this datagridview shows unusual behavior so from my side the solution could be:-

1) check whether the field is not read only.
2) try to unload the application and rebuild it and then re-run it.
3) Try to add new grid with same configuration.(but this must be the last option)

Hope this will help you out.

Thanks
   
Rate this:
Please Sign up or sign in to vote.

Solution 3

use template field, for this not of inbuilt type check box column.
<asp:GridView ID="grdMain" runat="server" AutoGenerateColumns="False"  OnRowDataBound="grdMain_RowDataBound" OnRowCommand="grdMain_RowCommand">
     <Columns>
        <asp:TemplateField HeaderStyle-Height="25px" ItemStyle-Height="25px">
         <ItemTemplate>
        <asp:CheckBox ID="chkSelect" runat="server" />
     </ItemTemplate>
                           <HeaderStyle CssClass="GreenBorder" HorizontalAlign='left' />

                     </asp:TemplateField>
                      <asp:TemplateField>
                       <HeaderTemplate>
                                      Serial No.
              </HeaderTemplate>
 <ItemTemplate>
       <asp:Label ID="lblSerialNo" runat="server" Text='<%#Eval("Serial_No")%>'></asp:Label>
                            </ItemTemplate>

</asp:TemplateField>
</Columns>
</asp:GridView>

use like this , Hope this will help you.
Don't froget to mark as answer if it helps. :)
   
Rate this:
Please Sign up or sign in to vote.

Solution 4

Try this URL...............................Selecting multiple checkboxes inside a GridView control[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100