搞了一个上午,唉,,累死我。
<code>
private void DataGrid1_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = (ListItemType)e.Item.ItemType;
if (itemType == ListItemType.Item||itemType == ListItemType.AlternatingItem||itemType == ListItemType.SelectedItem)
{
//DropDownList dpl;
TableCell myTableCell ;
myTableCell = e.Item.Cells[1];
LinkButton myDeleteButton;
myDeleteButton = (LinkButton)myTableCell.Controls[0];
myDeleteButton.Attributes.Add("onclick", "return confirm('您真的要删除此行吗?');");
}
</code>