views:

32

answers:

2

how to get confirmation before a export button is cliked.if yes then then export function has to be done if no it should not be done

+3  A: 

confirm box?

if (confirm("Perform the export?"))
  performTheExport();
Scott Evernden
+1  A: 

I noticed that you are using asp.net. In webform applications, often we need a confirm dialog before doing postback.

//the page
<asp:button id="mybutton" runat="server" Text="Click to submit" />

//in code behind
mybutton.Click += (sender, args)=>
 {
     SubmitData();
 };

//if you need to confirm before submit, you can add:
mybutton.OnClientClick = "if (!confirm('are you sure?')) return;";
//another way
mybutton.Attributes["onclick"] = "if (!confirm('are you sure?')) return;";

If you want to use your 'own confirm box' instead of confirm('are you sure?'):

window.showMedalDialog('myConfirmPage.aspx')
Danny Chen