Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

 
Share this answer
 
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
 
Share this answer
 
use template field, for this not of inbuilt type check box column.
XML
<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. :)
 
Share this answer
 
Try this URL...............................Selecting multiple checkboxes inside a GridView control[^]
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900