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
vishnu sharma
NA
18
846
Not showing data in the fields in edit view
Jul 21 2018 6:17 AM
public ActionResult Update(int id = 0)
{
EntryTable entrytable = db.EntryTables.Find(id);
if (entrytable != null)
{
entrytable = new EntryTable
{
City = new SelectList(db.Cities, "CityId", "CityName"),
Category = new SelectList(db.Categories, "CategoryID", "CategoryName")
};
}
return View(entrytable);
}
//
// POST: /Home/Update/5
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Update(EntryTable entrytable)
{
if (ModelState.IsValid)
{
entrytable.City = new SelectList(db.Cities, "CityId", "CityName");
entrytable.Category = new SelectList(db.Categories, "CategoryId", "CategoryName");
db.Entry(entrytable).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Index");
}
return View(entrytable);
}
//view
<div class="container" style="width:40%; margin-top:2%;float:right">
@Html.LabelFor(model => model.CityId)
@Html.DropDownListFor(model => model.CityId, Model.City, "--Select City--", new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.CityId)
</div>
<div class="container" style="width:40%; margin-top:2%;float:left">
@Html.LabelFor(model => model.CategoryId)
@Html.DropDownListFor(model => model.CategoryId, Model.Category, "--Select Category--", new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.CategoryId)
</div>
Reply
Answers (
1
)
ado.net concepts problem
i am create store procedure of notification but how