mgmhicks
asked on
Problem loading bootsrap modal on asp button click
I've been trying to come up with a way to use asp validation controls, but also come up with a confirm yes or no modal when the user clicks the submit button.
So the user clicks submit button validation controls validate, and then this is what I am trying to run. I've tried it both ways.
HTML
What is the best way to handle this. I know I can build a confirm page, but that doesnt seem like the as (Nice??)
So the user clicks submit button validation controls validate, and then this is what I am trying to run. I've tried it both ways.
Private Sub btnConfirm_Click(sender As Object, e As EventArgs) Handles btnConfirm.Click
' ClientScript.RegisterClientScriptBlock(Me.GetType(), "ClientScript", "$('#ConfirmModal').modal('show');", True)
ScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "Confirm", "$('#confirmModal').modal('show'); ", True)
End Sub
HTML
<div class="modal fade" id="ConfirmModal" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalTitle">Payment Confirmation</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
Are you Sure ?
</div>
<br />
<div class="row">
<div class="col-md-12">
<asp:Button runat="server" ID="btnChk" CssClass="ui-button" Text="Yes" />
<asp:Button runat="server" ID="btnCancel" CssClass="ui-button" Text="No" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
What is the best way to handle this. I know I can build a confirm page, but that doesnt seem like the as (Nice??)
ASKER
Why isn't the following line not bringing up the modal window.
It works with jquery, but not with code behind.
Private Sub btnConfirm_Click(sender As Object, e As EventArgs) Handles btnConfirm.Click
ClientScript.RegisterClien tScriptBlo ck(Me.GetT ype(), "ClientScript", "$('#ConfirmModal').modal( 'show');", True)
End Sub
Modal window is in above code.
thanks
It works with jquery, but not with code behind.
Private Sub btnConfirm_Click(sender As Object, e As EventArgs) Handles btnConfirm.Click
ClientScript.RegisterClien
End Sub
Modal window is in above code.
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I found the answer at another service.
Check this demo.
http://www.tutorialrepublic.com/codelab.php?topic=bootstrap&file=activate-modals-via-javascript