Click here to Skip to main content
15,885,890 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear Friends,

I am learning mvc. how to retrieve value from database based on text box value.
For Eg. I created login page i give username and click login button then the username's First Name and Last Name display on home page.

I have tried lot of time but its didn't work.

What I have tried:

I have tried from this link, but i can't understand one lines in that: http://stackoverflow.com/questions/10718263/mvc3-text-box-text-change-event
Posted
Updated 13-Jul-16 10:59am
Comments
Richard MacCutchan 13-Jul-16 7:50am    
Then you should ask the person in SO who gave the 'solution'.
Vivek.anand34 13-Jul-16 8:19am    
der posted 4 years before and that is accepted soln. so don't know they are reply or not. tats y i ask with u all.. what is the soln for that.
Vivek.anand34 13-Jul-16 8:21am    
if any you have done before send some concepts...
F-ES Sitecore 13-Jul-16 8:21am    
You can't learn something like mvc from forum posts. Get a book on it and go through the basics or at the very least go through an online tutorial that shows you the basics. If you google "mvc music store" you'll find a tutorial that takes through building a site from scratch and that includes the kind of things you want to do here.

I've written a series of article that target beginners to get started with MVC. Here's the link:


[ASP.NET MVC 5: Building Your First Web Application - Part 1]

The article was an MVC 5 app, but the concept should be the same for MVC 3.

If you'd like, you can also download my eBook for a full reference on building an MVC app from scratch: http://www.c-sharpcorner.com/ebooks/asp-net-mvc-5-a-beginner-s-guide[ASP.NET MVC 5: Beginner's Guide]
 
Share this answer
 
Razor
 @{
    ViewBag.Title = "Access TextBox and TextboxFor Value From View To Controller In Asp.net MVC";
}
@using (Html.BeginForm("Index", "Home"))
{
     <b>Acess Textbox </b>
    @Html.TextBox("Name","")
    <br />
    <input type="submit" value="Submit TextBox" />
}


C#
 [HttpPost]
public ActionResult Index(int id = 0)
{
 string name = Request.Form["Name"].ToString();
 return View();
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900