Return to Snippet

Revision: 46176
at May 13, 2011 21:16 by kashif21


Initial Code
<asp:GridView ID="GridView1" runat="server" autogeneratecolumns="false">
        <Columns>
        <asp:TemplateField HeaderText="TITLE">
            <ItemTemplate>
                <asp:LinkButton ID="lnkTitle" runat="server" Text='<%#Bind("TITLE") %>'  CommandArgument='<%#Eval("ID")%>'  onclick="lnkTitle_Click"/>
            </ItemTemplate>
          </asp:TemplateField>
          <asp:boundfield datafield="TITLE" headertext="TITLE"/>
          <asp:boundfield datafield="DESCRIPTION" headertext="DESCRIPTION"/>
          <asp:boundfield datafield="OWNER" headertext="OWNER"/>
          <asp:TemplateField HeaderText="Enabled">
            <ItemTemplate>
                <asp:CheckBox ID="chkEnabled" runat="server" Checked='<%# Eval("ENABLED") %>'  />
            </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>



//////////////////////////////////Code Behind


   protected void lnkTitle_Click(object sender, EventArgs e)
        {
                   
            
            LinkButton lnkTiltle = (LinkButton) sender;
            Int32 ID=Convert.ToInt32(lnkTiltle.CommandArgument.ToString());
        }

Initial URL

                                

Initial Description

                                

Initial Title
Link Field and check box field in the Grid view

Initial Tags
link

Initial Language
ASP