Link to home
Start Free TrialLog in
Avatar of mgmhicks
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.

    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

Open in new window


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>

Open in new window


What is the best way to handle this.  I know I can build a confirm page, but that doesnt seem like the as (Nice??)
Avatar of Lokesh B R
Lokesh B R
Flag of India image

Avatar of mgmhicks
mgmhicks

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.RegisterClientScriptBlock(Me.GetType(), "ClientScript", "$('#ConfirmModal').modal('show');", True)
    End Sub

Modal window is in above code.

thanks
ASKER CERTIFIED SOLUTION
Avatar of mgmhicks
mgmhicks

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I found the answer at another service.