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
prabhu p
NA
181
115k
regarding Checkbox in mvc
Jan 16 2018 4:27 AM
i have a checkbox in view based upon database data(boolean) it should be checked and unchecked when that view loading
What i did
in view
@model RelSystem.DL.Model.Admin.UserAccount
@{
ViewBag.Title = "UserAccount";
}
<h2>UserAccount</h2>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="container customdiv">
<ul class="list-group">
<li class="list-group-item">
Super User
<div class="material-switch pull-right col-lg-5">
@Html.CheckBoxFor(model => model.SuperUsrChk)
<label for="SuperUsrChk" class="label-primary"></label>
</div>
</li>
</ul>
</div>
In contoller action
public ActionResult UserAccount()
{
UserAccount UA = new UserAccount();
UA.SuperUsrChk = true; //Checkbox model
return View(UA);
}
Model
public bool SuperUsrChk { get; set; }
public bool RequestorUsrChk { get; set; }
I am getting output as i need , please help on this
Reply
Answers (
1
)
Disable hyperlink if cell value null in gridview
view pdf file c#