//必須先將刪除button轉成樣板,在數據綁定時,提供一組屬性給delete button
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Button myBtn = e.Row.Cells[2].FindControl("Button1") as Button;
myBtn.Attributes.Add("onclick", "return confirm('您確定要刪除資料嗎?')");
}
全站熱搜