how to get confirmation box

Posted by Oswaldlily under ASP.NET on 9/27/2011 | Points: 10 | Views : 2886 | Status : [Member] | Replies : 3
How to get Confirmation box with Yes/No Buttons which should display immediately after clickin link..

I need in codebehind not in Presentation part




Responses

Posted by: Blessyjees on: 9/27/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi,

Write a javascript function for confirmation box and call this js function ClientClick on the control. If this event is not exist the corresponding control, you can onclick event as attribute from codebehind.

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: CS1401 on: 9/27/2011 [Member] Starter | Points: 25

Up
0
Down
OnClientClick="return confirm('Do you want to delete?')"
write down in your source side..

...

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: DotNetguy on: 9/27/2011 [Member] Starter | Points: 25

Up
0
Down
Hi ,

You can use in this way


----Source---

<form id="form1" runat="server">
<div>
<asp:Button ID="btnOpenConfirm" runat="server" Text="Open Confirm" OnClick="btnOpenConfirm_Click" />
<asp:Button ID="btnOkClick" runat="server" Text="Execute Code On OK" OnClick="btnOkClick_Click" />
</div>

</form>


---code behined-----------

protected void btnOpenConfirm_Click(object sender,EventArgs e)
{
ClientScript.RegisterStartupScript(this.GetType(),
"OpenConfirm", "if(confirm('Are you sure you want to delete?')){document.getElementById('btnOkClick').click(); };", true);
}
protected void btnOkClick_Click(object sender, EventArgs e)
{
Response.Write("Deleted");
}

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response