0

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);
}

2 Answers 2

2

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>
Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.