对Datagrid添加删除确认的脚本(转)
原创:http://blog.csdn.net/hnwanghb/archive/2005/03/03/309683.aspx
private void dgTeam_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType==ListItemType.AlternatingItem || e.Item.ItemType==ListItemType.Item)
{
LinkButton btnLinkDelete=(LinkButton)e.Item.Cells[4].Controls[0];
if(btnLinkDelete!=null)
{
Label labTeamName=(Label)e.Item.FindControl("LabName");
string strScript="return ConfirmDelete('"+labTeamName.Text.ToString()+"');";
btnLink
}
}
}
html部分我就不写了,应该没什么问题了吧!