how to handle datagrid item command in C#?
Can anyone share a code snippet to handle the link button with Update command in C#? The link button is a template column inside a datagrid.
ASPX code:
<asp:TemplateColumn HeaderText="Update">
<ItemTemplate>
<asp:LinkButton Runat="server" Text="Update" CommandName="Update" ID="Linkbutton1" NAME="Linkbutton1"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn
I tried the following C# code:
private void grdOrderItems_ItemCommand(Object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if (e.CommandName == "Update")
{
...
}
}
But the handler did not get called when the link button was clicked.
Thanks.Hello, i recommend you check this pageAdding Button Columns to a DataGrid Control.
Good Luck.
Labels: ado, aspx, button, code, column, command, datagrid, handle, inside, item, link, net, share, snippet, template, update
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home