access controls in MVC [Resolved]

Posted by Varun66 under ASP.NET MVC on 7/31/2013 | Points: 10 | Views : 1159 | Status : [Member] | Replies : 2
Hi,

In MVC, we don't have ode-behind file, so how can i get the texbox values in controller?

Thanks,
Varun.




Responses

Posted by: Kmandapalli on: 7/31/2013 [Member] Silver | Points: 50

Up
0
Down

Resolved
Hi,

Suppose, you have a View named Registration and you have all the controls in this and if you need to save this data into database, you can do as follows:

In your View, you write all the code inside a form
and in the controller write the HttpPost ActionMethod like this:
[HttpPost]
public ActionResult Registration(FormCollection form)
{
......
}

What all values that you give, you will get in FormCollection and you can access from this form.

Mark as Answer if satisfied......

Thanks,
Shree M.

Kavya Shree Mandapalli

Varun66, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Varun66 on: 7/31/2013 [Member] Starter | Points: 25

Up
0
Down
Hi Shree,

Thank you for your immediate response..

Thanks,
Varun.

Varun66, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response