A
A.M
Hi,
I have this column in my DataGrid:
<asp:ButtonColumn DataTextField="site_name" HeaderText="Name"
CommandName="Select1">
<ItemStyle HorizontalAlign="Left" VerticalAlign="Top"></ItemStyle>
</asp:ButtonColumn>
This is how I bind the command to event handler:
this.dg.ItemCommand += new
System.Web.UI.WebControls.DataGridCommandEventHandler(this.dg_Command);
And this is the event handler:
private void dg_Command(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
// Should handle all dg's commands including CommandName="Select1"
string s;
s = e.Item.ItemIndex.ToString(); //I have a breakpoint here
}
I have a breakpoint on the event handler and I found that the event handler
never being ran.
Is anything wrong with my way of hanling Command event?
Thanks,
Alan
I have this column in my DataGrid:
<asp:ButtonColumn DataTextField="site_name" HeaderText="Name"
CommandName="Select1">
<ItemStyle HorizontalAlign="Left" VerticalAlign="Top"></ItemStyle>
</asp:ButtonColumn>
This is how I bind the command to event handler:
this.dg.ItemCommand += new
System.Web.UI.WebControls.DataGridCommandEventHandler(this.dg_Command);
And this is the event handler:
private void dg_Command(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
// Should handle all dg's commands including CommandName="Select1"
string s;
s = e.Item.ItemIndex.ToString(); //I have a breakpoint here
}
I have a breakpoint on the event handler and I found that the event handler
never being ran.
Is anything wrong with my way of hanling Command event?
Thanks,
Alan