MVC fundamental website question

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
 
T

Tiny Montgomery

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.
 
R

rhaazy

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"];
 
P

Peter Morris

<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)
{
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top