Bob Schneider
asked on
Bootstrap Modal and ASP QueryString
I am implementing a bootstrap modal to edit individual records in a table. I need to pass a unique id to the modal when it opens so I can query the MS Sql Server db to pull/display the data to edit. Not sure how to do this. Code below. Note that the modal opens correctly. Just need to populate it with data so I can edit it. If there is a better approach, I am open to it, but I really like the way the modal opens.
Trigger:
Modal:
Trigger:
<a data-toggle="modal" href="#myModal" class="button"><%=Items(1, i)%></a>
Modal:
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Edit Item</h4>
</div>
<div class="modal-body">
<p>This is a large modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you both. I will piece this together and then open another question if I have more specific questions. To answer the db query question, I normally submit to the page itself and run a query and process the data before the page reloads.
I normally submit to the page itself and run a query and process the data before the page reloads.
In this case, you will want to use ajax to give the best results.
What you could do, however, is submit the page to itself as you are used to, throw the data to the modal. Use ASP to hard code the modal being open. https://getbootstrap.com/docs/4.6/components/modal/
It is a more modern and present experience to use ajax though
In this case, you will want to use ajax to give the best results.
What you could do, however, is submit the page to itself as you are used to, throw the data to the modal. Use ASP to hard code the modal being open. https://getbootstrap.com/docs/4.6/components/modal/
It is a more modern and present experience to use ajax though
Are you using jQuery ? This is not in the topics.
here Vanilla JS :
Open in new window