Adding a JavaScript confirmation prompt to a delete command button in an ASP.NET grid view?

后端 未结 4 878
天命终不由人
天命终不由人 2021-01-28 10:34

So I have an ASP.NET grid view:



        
4条回答
  •  北恋
    北恋 (楼主)
    2021-01-28 11:12

    In RowDataBound add -

    LinkButton objDelete = e.Row.Cells[0].Controls[0] as LinkButton;
    objDelete.Attributes.Add("onclick", "javascript:return confirm('Do you want to delete this item?');");
    

提交回复
热议问题