datagrid deletion confirmation

Results 1 to 2 of 2

Thread: datagrid deletion confirmation

  1. #1
    Join Date
    Dec 1969

    Default datagrid deletion confirmation

    Hi<BR><BR>when click on delete button in datagrid I want to pop up delete confirm message .I tried this but my routine "deleterow" is not bounded to datagrid where i have to call this?<BR><BR>&#060;asp:Button id="delid" runat="server" Text="del" CommandName="delete" /&#062;<BR><BR>protected void deleterow(object sender, System.Web.UI.WebControls.DataGridCommandEventArgs e) <BR>{<BR>if ((e.Item.ItemType == ListItemType.Item) &#124&#124 (e.Item.ItemType == ListItemType.AlternatingItem))<BR>{<BR>System.Web. UI.WebControls.Button btn = ((Button)e.Item.FindControl("delid"));<BR>btn.Attr ibutes.Add("onclick", "return confirm_delete();");<BR>}<BR>}

  2. #2
    Join Date
    Dec 1969

    Default RE: datagrid deletion confirmation

    &nbsp;<BR>Here is the solution.Write this code in Item created command of the datagrid.<BR><BR>Dim mytableCell As TableCell<BR>Dim lnkRemove As LinkButton<BR>mytableCell = e.Item.Cells(2) &#039;&#039; the Remove button<BR>lnkRemove = mytableCell.Controls(0)<BR>lnkRemove.Attributes.Ad d("onclick", "return confirm(&#039;Are you sure you want to remove ?&#039;);")<BR><BR>All the best...........<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts