Click here to Skip to main content
12,953,865 members (42,739 online)
Rate this:
Please Sign up or sign in to vote.
See more:
how to pass data from one view to controller in mvc3
Posted 29-Dec-11 3:02am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Rate this: bad
Please Sign up or sign in to vote.

Solution 2


There are number ways available in mvc to pass the data from view to controller. it depends on what's the story on your application means where you want to pass the data in controller ,POST or In GET Method.

In GET Method you can pass the value by calling action using java script or jqury.

I will explain you how to pass value from view to POST Method in controller by using in "FormCollection"

FormCollection is generic collection in which value store in "key-Value" pair. but you can get value from this only on POST Method.

refer following code stuff.

In View

In Controller
public ActionResult ActionName(FormCollection coll)
   string value = coll["Key"];

In this way also you can pass the value from view to controller POST Method.

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,464
CHill60 3,490
Maciej Los 3,123
ppolymorphe 2,020
Jochen Arndt 1,975

Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 12 Sep 2012
Copyright © CodeProject, 1999-2017
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