MVC fundamental website question

  • Thread starter Thread starter Tiny Montgomery
  • Start date Start date
T

Tiny Montgomery

Hey,

So, I think I'm missing something fundamental, and I can't find any
good examples online so I thought maybe someone can push me in the
right direction. I have a MVC website that I'm working on and it's
easy to pass information from the controller to the view via the
viewdata object, but how do you get data from the view back to the
controller outside of a query string in the url? Like is there an
object that I'm totally missing that contains the form information, or
am I just fundamentally missing something?

Thanks,

Tiny
 
Ok, I am just missing the ball. Everything I'm looking for is in the
Request.Form object. Yikes...so simple. BTW, I'm not a web dev if
you haven't guessed it.
 
If you can't use a query string, use a session variable.

To create a variable do something like this:
Session["UserLDAPAlias"] = user.LDAPAlias;

then to retrieve your info again...

string LDAPAlias = Session["UserLDAPAlias"];
 
<form action="SavePerson" method="post">
<input name="id" type="hidden" value="1"/>
<input name="FirstName" />
<input name="LastName" />
<input name="Salutation" />
<input type="Submit" value="Save"/>
</form>


public void SavePerson(int id, string firstName, string lastName, string
salutation)
{
}
 
Back
Top