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
Jinish Gandhi
NA
83
770
MVC4 Razor( How To get a specific value from database
Feb 29 2016 3:37 PM
i am using entity data model in mvc 4,i want specific value from dabase like as(select username from Emp where RollId="Textbox1.text")
but in mvc code
______________________________________________________________________
1.[view file code]-->GetResultView
@using(Html.BeginForm("GetResult","Login",FormMethod.Post))
{
<div>
@Html.TextBoxFor(Model=>Model.UserName)
</div>
<div>
@Html.DisplayFor(Model=>Model.RollId)
</div>
<div>
<input type="submit" value="GetResult" name="GetResult">
</div>
}
----------------------------------------------------------------------------------------------------------------------------
2.[Controller]
public ActionResult GetResult()
{
return View();
}
[HttpPost]
public ActionResult GetResult(EmpInfo_Tbl ET)
{
using (db)
{
var v = db.EmpInfo_Tbl.Where(u => u.UserName.Equals(ET.UserName)).Select(u =>u.RollId).FirstOrDefault();
ViewBag.RollId = v.ToString();
}
return View(ET);
}
------------------------------------------------------------------------------------------------------------------------
But in all thing i get value zero...but i didnt get excatly values..so plz help me to find out..:)
Reply
Answers (
3
)
Is there any future in Windows Forms Application?
I Need To Send File On Server Using SFTP, But It Is Not Work