Friday, August 24, 2012

c# – Use jQuery alert and confirmation popup on same ASP button?

I have a situation where I need both alert and confirmation popup on same ASP button. I need alert for validation, once user enters all the necessary info i need confirmation popup to send email or submit another entry.


I am already using jQuery dialog popup for both alert and confirmation, but no idea how to combine them on same button.


//My Confirmation code



<script type=\"text/javascript\">
jQuery(function() {
var dlg = jQuery(\"#dialog\").dialog({

draggable: false,
autoOpen: false,
minHeight: 10,
minwidth: 10,
zIndex: 99999

});
$(\'#<%=btnStart.ClientID%>\').click(function() {
$(\'#dialog\').dialog(\'open\');
});
$(\".ui-dialog-titlebar\").hide();
$(\".ui-dialog-titlebar-close\").hide();
dlg.parent().appendTo(jQuery(\"form:first\"));
});
<asp:Button id=\"btnStart\" runat=\"server\" Text=\"btnStart\" onclick=\"btnStart_Click\" />
<div id=\"dialog\" style=\"text-align: center; display: none;font-size:14px;\">
<table>
<tr>
<td colspan=\"2\">
<asp:Label Text=\"Do you want to exclude these dates?\" runat=\"server\" ID=\"lbl\"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Button ID=\"btnOk\" runat=\"server\" Text=\"Yes\" OnClick=\"btnOK_Click\" Style=\"width: 60px;\" />
</td>
<td>
<asp:Button ID=\"Button1\" runat=\"server\" Text=\"No\" OnClick=\"btnCancel1_Click\" Width=\"60px\" />
</td>
</tr>
</table>
</div>


//My Alert Popup



$(document).ready(function() {
$(\'#<%=btnStart.ClientID%>\').click(function() {
alert(\"Correct it!\");
});

});


This is .net web application.






Rating: 5 out of 5 based on 3 ratings



The post c# – Use jQuery alert and confirmation popup on same ASP button? appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/c-use-jquery-alert-and-confirmation-popup-on-same-asp-button.html

No comments:

Post a Comment