0

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

Innova
  • 4,831
  • 21
  • 76
  • 107
  • see alternative jquery plugin: http://stackoverflow.com/questions/6457750/form-confirm-before-submit/12357337#12357337 –  Sep 11 '12 at 12:17

2 Answers2

4

confirm box?

if (confirm("Perform the export?"))
  performTheExport();
Scott Evernden
  • 39,136
  • 15
  • 78
  • 84
2

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')
Cheng Chen
  • 42,509
  • 16
  • 113
  • 174