日期:2014-05-18  浏览次数:20386 次

在一个datagrid中能否加两个按钮列??
在一个datagrid中能否加两个按钮列??   谢谢

------解决方案--------------------
<asp:TemplateColumn HeaderText= "按钮列 ">
<ItemTemplate>
<asp:Button CommandName= "add " Runat= "server " Text= "add "> </asp:Button>
<asp:LinkButton CommandName= "edit " Runat= "server "> edit </asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>

在cs中
private void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if(e.CommandName == "add ")
{
// to do:

}
else if(e.CommandName == "edit ")
{
// to do:
}
}