I have already added a checkbox column in grid and later on dynamically adding other columns and data.
I can see that column is appearing in grid with other columns but am not able to check/uncheck any individual row.

Anybody can tell me whats I am missing? For more reference here is the code.

<asp:GridView ID="gdv_items" runat="server" EnableModelValidation="True" >
        <Columns>
            <asp:CheckBoxField HeaderText="Select" />
        </Columns>
</asp:GridView>            

            gdv_items.DataSource = dt_items;// Datatable already loaded from DB.

            gdv_items.DataBind();

Recommended Answers

All 2 Replies

I think you need to add an a checkbox within an itemtemplate in a gridview..something like:

<asp:TemplateField HeaderText="Login"><ItemTemplate><asp:Button ID="btnLogin" runat="server" Text="Login" CommandArgument='<%# Eval("MemberId", "{0}")%>' CommandName="Login" ToolTip="Click here to Login" CssClass="btnbgtrans"/></ItemTemplate><HeaderStyle Width="5%" ForeColor="Black" CssClass="titleCommission paddingleft5" HorizontalAlign="center"/><ItemStyle HorizontalAlign="center" CssClass="paddingleft5"/></asp:TemplateField>

I've placed a command button in my grid, however the concept is just the same.

dude you are missing ItemTemplate. go to youtube.com

i have uploaded gridview videos for you guys.
search for dnanetwork or Gridview

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.