必须定义 CommandName :
<asp:ButtonColumn HeaderText="Remove from cart" Text="Remove" CommandName="AddToCart" />然后定义 OnItemCommand:
<ASP:DataGrid id="MyDataGrid" runat="server" OnItemCommand="Grid_CartCommand" >得到列:
void Grid_CartCommand(Object sender, DataGridCommandEventArgs e) {
if (((LinkButton)e.CommandSource).CommandName == "AddToCart") {
//do something;
}else { }
}
<asp:ButtonColumn HeaderText="Remove from cart" Text="Remove" CommandName="AddToCart" />然后定义 OnItemCommand:
<ASP:DataGrid id="MyDataGrid" runat="server" OnItemCommand="Grid_CartCommand" >得到列:
void Grid_CartCommand(Object sender, DataGridCommandEventArgs e) {
if (((LinkButton)e.CommandSource).CommandName == "AddToCart") {
//do something;
}else { }
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货