Reputation: 91
The web form has grid view which contains Delete link. On clicking the link, confirmation message should be displayed. I am using function which displays the confirmation dialog box. On clicking OK button, the respective record should be deleted. How can I pass some value on clicking OK button in the dialog box to perform delete operation?
void ConfirmMsg(string cMsg)
{
Type cstype = this.GetType();
// Get a ClientScriptManager reference from the Page class.
ClientScriptManager cs = Page.ClientScript;
String cstext = "confirm('" + cMsg + "');";
cs.RegisterStartupScript(cstype, "PopupScript", cstext, true);
}
Upvotes: 0
Views: 839
Reputation: 583
just use this line in place of ur delete button.nothing needed:
<asp:LinkButton ID="lbDelete" runat="server" OnClientClick="return confirm('Are you sure want to delete the Company Information?')" CausesValidation="False"
CommandName="Delete" Text="Delete"></asp:LinkButton>
Upvotes: 2
Reputation: 1000
use a link button as Delete link and
OnClick = your delete function
OnClientClick = return Confirm("Confirmation message")
if user clicks OK, the function in OnClick will execute. Otherwise it will not
Upvotes: 0