Click here to Skip to main content
15,877,103 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Team

I need some help to create save functionality to my modal popup, i want this popup when a user create the course name it must be saved as a raw data with bootstrap card. Currently i made the modal popup to generate new courseregistration page with no data and need some help around this.

What I have tried:

    public ActionResult CoursesRegistration( int? id)
          return View();

<div class="modal-footer">
                                         <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
                                         <a class="btn btn-large btn-success" id="fire" href="@Url.Action("CoursesRegistration", "Home")">Create Courses</a>
                                         <script type="text/javascript">
                                             $('#fire').on('click', function (e) {

Updated 19-Aug-20 2:08am
Sandeep Mewara 19-Aug-20 7:20am    
Where are you struggling? Do you want to submit the original form, when user clicks on the submit button on the modal dialog?
gcogco10 19-Aug-20 7:52am    
Yes Mewara

1 solution

Given you want to submit the original form, when user clicks on the submit button on the modal dialog

you whould need to wire up the click event on that button and programmatically submit your form

try something like below:
1. Give your submit button inside the modal an Id to wire up the click event.
<input type="submit" id="btn-submit" class="btn btn-primary" />

2. Register click event on this button.
3. Use the jQuery closest method to get the form where you forms submit button is present
4. Use the form submit button using the jquery to save.

$(function () {

    $("#btnSubmit").click(function (e) {

    $("#btn-submit").click(function() {
        alert("Submit base form!");

UPDATE, if needed, a similar query probably: javascript - Insert Data from Modal Bootstrap MVC 4 + JQuery (Post Method) - Stack Overflow[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900