Requirement:To save selected checkbox values in a table in database.
Model:
public class Profiletemplate
{
public int RoleID { get; set; }
public string FieldName { get; set; }
public string BlockName { get; set; }
public int FieldID { get; set; }
}
Controller:
if (ModelState.IsValid)
{
objent.sp_addProfileTemplate(pro.RoleID, pro.BlockName, pro.DisplayOrderBlock, pro.DisplayOrderField, pro.FieldID, pro.ValueType, pro.Maxlength, pro.IsRequired, pro.FieldColumnNumber, Convert.ToInt32(Session["ID"].ToString()));
return RedirectToAction("ProfileTemplate", "Admin");
}
View:
@foreach (var cat in Model.lstfields)
{
@cat.FieldName
}
I couldnot pass FieldID to my controller to save it in my database.
Please help me to resolve this issue Thanks in Advance.
Regards,
Anisha.
Asma KhalidPosted Feb 9, 2018, 6:35 AM