J
Jeff S
I have a DataList that includes a <table> definition in the <ItemTemplate>.
The <table> includes an asp:Button that, when clicked, causes a postback
during which some data is deleted (it's a button labeled "Delete"). The
<table> also includes a second button that, when clicked, enables the user
to edit data (although not using an <EditItemTemplate>). When the user
clicks the Delete button, I want to prompt the user to confirm that they
want to delete the data before the postback occurs. The following line works
great for asp:Buttons that are not included in a DataList.
btnDeleteWidget.Attributes.Add("onclick", "return confirm('Delete selected
widget?');");
This line of code serves to pop up the message when the user clicks any
button being rendered as part of the DataList (in my case the same
message/prompt appears when the user clicks either the Edit or the Delete
buttons):
MyDataList.Attributes.Add("onclick", "return confirm('Delete selected
widget?');");
But what I want is for the message box/prompt to appear only when the user
clicks on the Delete button in the DataList (and to not appear when the user
clicks the Edit button that is also in the DataList). Any suggestions for
how to accomplish this?
Thanks!
The <table> includes an asp:Button that, when clicked, causes a postback
during which some data is deleted (it's a button labeled "Delete"). The
<table> also includes a second button that, when clicked, enables the user
to edit data (although not using an <EditItemTemplate>). When the user
clicks the Delete button, I want to prompt the user to confirm that they
want to delete the data before the postback occurs. The following line works
great for asp:Buttons that are not included in a DataList.
btnDeleteWidget.Attributes.Add("onclick", "return confirm('Delete selected
widget?');");
This line of code serves to pop up the message when the user clicks any
button being rendered as part of the DataList (in my case the same
message/prompt appears when the user clicks either the Edit or the Delete
buttons):
MyDataList.Attributes.Add("onclick", "return confirm('Delete selected
widget?');");
But what I want is for the message box/prompt to appear only when the user
clicks on the Delete button in the DataList (and to not appear when the user
clicks the Edit button that is also in the DataList). Any suggestions for
how to accomplish this?
Thanks!