日期:2012-09-04  浏览次数:21013 次

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()+"');";

btnLinkDelete.Attributes.Add("onclick",strScript);
}
}
}


html部分我就不写了,应该没什么问题了吧!