Free Jobs
Reference




Dot Net Forums: ASPNET (77) C#.NET (39) VB.NET (8) AJAX (21) Silver Light (1) WCF (10) WPF (1) WWF (1) .NET 3.5 (3) SQL SERVER (38) Other (3)

Topic: How to Implement javascript confirm popup in ASP.NET C#

To get the Posted Questions details daily in your mail Click Here

Share this Post on Facebook/Twitter/Orkut Bookmark and Share





User: dhiraj5079 Post Date: 18 Jan 2012 00:05

Introduction:
In this post we will learn how to How to Implement javascript confirm popup in ASP.NET C#



Main Content:
<script type="text/javascript" >

function ConfirmSampleMessage()

{

var result = confirm('' Sample message \n new line message \n\n Press Ok to continue and Cancel to end the process '');

if(result)

{

document.GetElementById(''<%=SampleHiddenButtonSecond.ClientID%>'').click();

}

}

</script>



in html page there are two button

on the click of first button this popup will come

<asp:button ID="SampleHiddenButtonFirst" runat="server" OnClick="SampleHiddenButton_Click"

Style="display :none" />

<asp:button ID="SampleHiddenButtonSecond" runat="server" OnClick="SampleHiddenButton_Click"

Style="display :none" />



event in code behind

private bool confirm = false;

protected void SampleHiddenButtonFirst_Click(Object sender EventArgs e)

{

if(!confirm)

{

 ScriptManager.RegisterStartupScript(page, typeOf(Page),"script",ConfirmSampleMessage();",true);

 confirm = true;

 break;

}

}

protected void SampleHiddenButtonSecond_Click(Object sender EventArgs e)

{

  confirm = true;

  //this will call the first button event.

  SampleHiddenButtonFirst_Click(sender,e);

}

Conclusion:
This way we can Implement javascript confirm popup in ASP.NET C#



About Writer:
Hi,I am IT Professional From Mumbai


Writer's Link: http://

Writer's Email:







Comments:
Post Comment





Similar Articles Top ArticlesLatest Articles Other Articles by this Author







www.freejobsreference.com Copyright © 2009-2011 | All Rights Reserved
All content of this website is protected by copyright laws and should not be reproduced in any form or by any means without written permission
(Best viewed in IE 8.0+ or Firefox 3.0+ at resolution of 1024 * 768 or higher)