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
Shibly Sadik
NA
167
139.7k
Edit data in mvc entity framework database
Feb 27 2015 10:52 AM
I have created a database using mvc CRUD operation.My edit action is as below:
// GET: /Student/Edit/5
public ActionResult Edit(
int id
)
{
if (
id
== null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
MyStudent mystudent = db.mdb.Find(
id
);
if (mystudent == null)
{
return HttpNotFound();
}
return View(mystudent);
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Edit([Bind(Include="Roll,Name,Dept,Gender,Phone")] MyStudent mystudent)
{
if (ModelState.IsValid)
{
db.Entry(mystudent).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Index");
}
return View(mystudent);
}
Now what i want to is to take the value of the parameter
id
through a textbox from user and perform the edition.
I'm very beginner. Help me please..
Reply
Answers (
1
)
grid in mvc
Change image