Guest User

Guest User

  • Tech Writer
  • 2.1k
  • 473.3k

How to create a new content in asp.net mvc?

Aug 17 2020 6:23 AM
Hi Team
 
I want to create a new content, when a user click the button. I dont if my logic would be correct to say below but if not please assist me.
 
  1. <div class="row">  
  2.             <div class="col-xs-3 ml-auto">  
  3.                 <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">  
  4.                     Start New Course  
  5.                 </button>  
  6.             </div>  
  7.         </div>  
  8.   
  9.   
  10.         <!-- Modal -->  
  11.         <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">  
  12.             <div class="modal-dialog" role="document">  
  13.                 <div class="modal-content">  
  14.                     <div class="modal-header">  
  15.                         <h5 class="modal-title" id="exampleModalLabel">Start New Course</h5>  
  16.                         <button type="button" class="close" data-dismiss="modal" aria-label="Close">  
  17.                             <span aria-hidden="true">×</span>  
  18.                         </button>  
  19.                     </div>  
  20.                     <div class="form-group">  
  21.                         <label for="CourseName" class="col-sm-2 col-form-label">CourseName:</label>  
  22.                         <div class="col-sm-6">  
  23.                             @Html.EditorFor(model => model.CourseName, new { htmlAttributes = new { @class = "form-control", autofocus = "autofocus", placeholder = "CourseName" } })  
  24.   
  25.                         </div>  
  26.   
  27.   
  28.                     </div>  
  29.                     <div class="modal-footer">  
  30.                         <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>  
  31.                         <button type="button" class="btn btn-primary">Create Course</button>  
  32.                     </div>  
  33.                 </div>  
  34.             </div>  
  35.         </div>  
  36. </div>  
  37.   
  38.   
  39. <div class="modal-footer">  
  40.                                 <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>  
  41.                                 <button type="button" class="btn btn-primary">Create Course</button>  
  42.                             </div>  
  43.                         </div>  
  44.                     </div>  
  45.                 </div>  
  46.         </div>  
  47.       
  48.     // Jquery  
  49.     <a class="btn btn-large btn-success" id="fire" href="/Controller/Courses.chtml#">Create Courses</a>  
  50.       
  51.     $('#fire').on('click', function (e) {  
  52.       
  53.          // dont know what to put here....?  
  54.       
  55.       
 

Answers (1)