TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sabab Zulfiker
NA
85
25.4k
Fetching data into checkboxes without using Html Helper
Mar 15 2018 1:04 AM
I have a language table in database, which contains language id and language name. The language table class is like below:
public partial class tblLanguage
{
public int colLanguageId { get; set; }
public string colLanguageName { get; set; }
public string colLanguageShortName { get; set; }
public Nullable
colSerialNo { get; set; }
}
I am retrieving the language from database and pass them to the view and bind them with checkboxes, without using html helper method.
My controller code is below:
[HttpGet]
public ActionResult Save()
{
var languageList = db.tblLanguages.ToList();
ViewBag.Language = languageList;
return View();
}
And the code of the view is :
@{
ViewBag.Title = "Save";
Layout = "~/Views/Shared/_Layout.cshtml";
List
languageList = ViewBag.Language;
}
Language:
@foreach (var languageItem in languageList)
{
@languageItem.colLanguageName
}
My question is how can I pass the checked values of the checkboxes to controller after performing POST operation.
N.B. I should not use HTML Helper or Html BeginForm().
Reply
Answers (
1
)
How to scroll gridview with horizontally and vertically?
if city name is same then it print only one time?