Calling bootstrap modal window from asp.net

when I submit a form, I need to validate one of the fields and if all is good I would like to load a bootstrap modal verifing that they are sure.  That form has a cancel and submit button.   If they submit I want to run code behind to post the transaction, or cancel will close the confrim modal and leave them where they are.  Question is I am using the following script and I cant get the modal window to show.   Here is the code behind I am using and the code of the dummy modal window I am trying to get to work.

 Dim myPayment As New CheckPaymentService
        Dim mBankName As String = String.Empty
        If myPayment.CheckRouteNo(Trim(txtRouteNo.Text), mBankName) Then
            ClientScript.RegisterClientScriptBlock(Me.GetType(), "ClientScript", "$('#MainContent.basicModal1').modal('show'); ")
            ' continue with processing
        Else
            CheckBox1.Checked = False
            ClientScript.RegisterClientScriptBlock(Me.GetType(), "ClientScript", "bootbox.alert ('Invalid Route Number') ", True)
        End If

Open in new window


<div class="modal fade" id="basicModal1" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="false">Close</button>
                    <h4 class="modal-title" id="myModalLabel">Terms and Conditions</h4>

                </div>
                <div class="modal-body">
                    <h3>I hereby authorize MGM Enterprises, Inc., dba The Apartment Gallery,  dba Waterford Associates, to debit my bank account through the electronic 

Automated Clearing House (ACH) network within one to three business days from the date of this payment. I am aware that in the event The Apartment Gallery  is unable 

to secure funds from my bank account for this transaction for any reason, including but not limited to, insufficient funds in my account or insufficient or 

inaccurate information I provided when I submitted the electronic payment, further collection action may be undertaken by The Apartment Gallery, including 

application of returned check fees to the extent permitted by law.  If the payment is returned by my bank, I am still responsible for making a payment on my The 

Apartment Gallery or Waterford Associates account.</h3>
                </div>

            </div>
        </div>
    </div>

Open in new window

mgmhicksAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
It looks like the reason the modal is not showing is you are targeting the wrong thing.  

This is the code you need to make the modal show.
$('#basicModal1').modal('show'); 

Open in new window

You have
$('#MainContent.basicModal1').modal('show');

Open in new window

Notice you are targeting the ID MainContent with child class basicModal1.  What you need to target is the ID basicModal1 and that is it.  Since there is only one ID (or should be) my example will work.  I have noticed that some .ned developers seem to generate duplicate id's and that will break your javascript.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.