需要设置Web控件的CommandName,然后在 ItemCommand判断private void mainDataGrid_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if(e.CommandName=="xxxx")
{ ......
}
else if(e.CommandName=="xxxx")
{
...... }
}
{
if(e.CommandName=="xxxx")
{ ......
}
else if(e.CommandName=="xxxx")
{
...... }
}
详细内容 对应SelectedIndexChanged区分开
然后在itemCommand事件里判断他的e.CommandName
if(e.CommandName=="")
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/cpref/html/frlrfSystemWebUIWebControlsDataGridClassOnItemCommandTopic.htm