Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: GimmeCode MVC3
Hi all,
I was trying to find a simple appliation in MVC3 which does not have to do anything with entity framework.
all I need is one page(view) with one text box and one button. we should be able to enter some text in textbox and upon pressing button the text should got to model where a simple function can make it upper case and return string.
 
then this uppercsed text deisplayed on same view(page) or another page.
so a simple applicaiton where one can see how View Controller and Model talk to each other. that is all thanks.
Posted 11-Oct-12 17:13pm
Edited 11-Oct-12 17:56pm
Karthik. A33.7K
v2
Comments
Wes Aday at 11-Oct-12 22:56pm
   
Uh huh.... and? You just want someone to whip out a code solution for you just for the fun of it? Did you plan on paying someone to perform this work for you? Did you read the posting guidelines, that were right in front of you while posting your "question", that instructed you not to ask for code?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

1) Install MVC3 on your development machine.
2) Open Visual Studio 2010
3) Create a new Project -> Visual C# -> Web -> ASP.NET MVC 3 Web Application
4) Hit OK
5) Voila, you have a fully functional MVC3 Application that doesn't use Entity Framework.
6) Create a textbox on you Home/Index view and provide the appropriate Controller method.
7) Ask a question about the code where you fail that we will be willing to answer.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

First of all my apologies for asking a question which looks like a request for a code, however it was not my original intention. May be I have not choose my words carefully. All I wanted was a way to pass information between views, controller and models without Entity FrameWork. Please note my first language is not English that may cause the confusion.
I have been doing some research so I will explain what I learn, for those who may have same issues and would come to this page.
There are following ways to get values from view back to controller after submitting the form. lets assume I have a text box in my form(View) named "txtBox" and I want to pass whatever user types in, back to controller.
 
1. FormCollection object
FormCollection is builtin object, which will give you access to all controls of the form.
 
public ActionResult Index (FormCollection col) {
string str = col["txtBox"];
}
 
2. Request object
public ActionResult Index () {
string str = Request["txtBox"];
}
 
3. I can't name it but it is a simple parameter passing. please note that name of parameter should be same as name of control(in this case txtBox). you can have multiple parameters depending upon number of controls you want to access. I agree not a very pretty way, but it works.
public ActionResult Index (string txtBox) {
string str = txtBox;
}
 
and ofcourse we have the option to tie your view to Model and then pass that model object back to controller.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 605
1 Maciej Los 319
2 BillWoodruff 184
3 Richard MacCutchan 180
4 Suraj Sahoo | Coding Passion 180
0 OriginalGriff 8,654
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,229
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 17 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100