Hello Everyone,
Hope everyone is fine !
I have bind Contact in CheckBoxList successfully.
But i am not ableto save the checked item to database.Everyone while saving , it shows the List as Null.
Following is my View Code :
- @foreach (var item in ViewBag.ContactsCheckbox)
- {
- class="custom-control custom-checkbox">
- "chk@(item.Id)" class="custom-control-input" type="checkbox" value="@item.Id" checked="@item.IsChecked" />
- ="custom-control-label" for="chk@(item.Id)">@item.ContactName
- }
Following is Controller Code :
- public ActionResult Add(MemoriesImagesMaster mi, List
items) - {
- Do_Validation val = new Do_Validation();
- List
list = new List (); - Guid LoginId = new Guid(Session["UserId"].ToString());
- foreach (ContactsMaster item in items)
- {
- if (item.IsChecked)
- {
- ViewBag.Message += string.Format("{0}\\n", item.ContactName);
- }
- }
- }
On View, the data is bind using Memory Model and on same the list is getting bound using the Contact Model
Thank you in advance.
Guest UserPosted Jul 1, 2020, 1:41 PM
Laxmidhar SahooPosted Jun 27, 2020, 11:29 PM
Rajanikant HawaldarPosted Jun 27, 2020, 1:52 PM