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
bubai banerjee
NA
24
0
display result using MVC4
Aug 11 2016 1:10 AM
In my <strong>MVC</strong> application,<br /> i want display result (when i enter the application no in Id textbox,it will display the customer FirstName,LastName,Address in respective textboxes <br /> instead of displaying it in webgrid,in the same page by using EF.<br /><div> i am using mvc4,visual studio 2012 and EF.Thanks in advance.Can anyone please help me.</div><div> </div><div> CREATE TABLE [dbo].[tblCustomer](<br /> [Id] [int] IDENTITY(1,1) NOT NULL,<br /> [FirstName] [varchar](50) NULL,<br /> [LastName] [varchar](50) NULL,<br /> [Address] [varchar](50) NULL,<br /> CONSTRAINT [PK_tblCustomer] PRIMARY KEY CLUSTERED <br /> (<br /> [Id] ASC<br /> )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]<br /> ) ON [PRIMARY]<br /> </div><div> <br /><h4>Index View<br /></h4> <br /> @using (@Html.BeginForm("Index","Home",FormMethod.Post))<br /> { <br /> Enter Id :@Html.TextBox("Id")<br /> <input type="submit" name="Search" value="Search" /><br /> }<br /> <br /> <strong>Home controller</strong><br /> <br /> <strong>[HttpGet]</strong><br /> public ActionResult Index()<br /> {<br /> return View();<br /> }<br /> <br /> [HttpPost]<br /> public ActionResult Index(int Id)<br /> {<br /> var qry = se.tblCustomers.Single(m => m.Id == Id);<br /> return View("_Details", qry);<br /> }<br /> <strong><br /> Details View:</strong><br /> <br /> <br /> <fieldset><legend><strong>tblCustomer</strong></legend><br /><div> @Html.DisplayNameFor(model => model.FirstName)<br /> </div> <div><br /> @Html.DisplayFor(model => model.FirstName)<br /> </div> <br /> <div><br /> @Html.DisplayNameFor(model => model.LastName)<br /> </div> <div><br /> @Html.DisplayFor(model => model.LastName)<br /> </div> <br /> <div><br /> @Html.DisplayNameFor(model => model.Address)<br /> </div> <div><br /> @Html.DisplayFor(model => model.Address)</div></fieldset></div>
Reply
Answers (
3
)
Adding a column to AspNetUserRoles table in MVC
How to save and retrive value of checkboxfor in mvc???