help me to insert checkbox selected data into the database with asp.net entity framework.I make stored procedure for insert in ssms.and use in controller.
this is my create function in controller.
SqlParameter param1 = new SqlParameter("@projectname", objstudent.projectname); SqlParameter param2 = new SqlParameter("@projecttype", objstudent.projecttype); SqlParameter param3 = new SqlParameter("@projectstatus", objstudent.projectstatus); SqlParameter param4 = new SqlParameter("@noofuser", objstudent.noofuser); SqlParameter param5 = new SqlParameter("@description", objstudent.description); SqlParameter param6 = new SqlParameter("@isNewlyEnrolled", objstudent.isNewlyEnrolled);
var data = objteam.Database.ExecuteSqlCommand("insertdata @projectname , @projecttype,@projectstatus,@noofuser,@description,isNewlyEnrolled", param1, param2, param3,param4,param5,param6);
this is my view
<div class="form-group">
@Html.LabelFor(model => model.isNewlyEnrolled, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@*@Html.CheckBox("isNewlyEnrolled")
@Html.CheckBoxFor(model => model.isNewlyEnrolled)*@
<input id="Checkbox1" type="checkbox" />c
<input id="Checkbox2" type="checkbox" checked="checked" />c++
</div>
</div>
I tryed to insert checkbox data in database with entity framework.
Aucun commentaire:
Enregistrer un commentaire