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);
}
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>
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.