Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 14-07-2009
Member
 
Join Date: Oct 2008
Posts: 115
How to pass MVC data from attribute to controller

I have project development where I need to provide attribute details to the controller, but the project requirement is to pass mvc data from attribute to controller, if anyone has any information about how to do this or any other relevant information please let me know.
Reply With Quote
  #2  
Old 14-07-2009
Member
 
Join Date: Apr 2008
Posts: 193
Re: How to pass MVC data from attribute to controller

MVC framework use for mobile as well as for other windows application hwer i will provide you the information about Mobile MVC framework, Mobile MVC framework updated the framework to handle the scenario of passing data between different controllers: the Controller class implements two new methods:

Code:
public void Initialize(params object[] parameters)

and:

protected virtual void OnInitialize(params object[] parameters)
The NavigationService class has also been updated to support passing the parameters to its NavigateMethod:

Code:
public static void Navigate(string name, params object[] parameters)

public static void Navigate(Controller controller, params object[] parameters)
Reply With Quote
  #3  
Old 14-07-2009
Member
 
Join Date: Dec 2008
Posts: 183
Re: How to pass MVC data from attribute to controller

The ASP.NET MVC framework provides page-level containers for passing data between controllers and views. This topic explains how to pass both weakly typed and strongly typed data in an MVC application. It also explains how to pass temporary state data between action methods.

C# code
Code:
List<string> petList = new List<string>();
petList.Add("Dog");
petList.Add("Cat");
petList.Add("Hamster");
petList.Add("Parrot");
petList.Add("Gold fish");
petList.Add("Mountain lion");
petList.Add("Elephant");

ViewData["Pets"] = new SelectList(petList);

}
For more info: http://msdn.microsoft.com/en-us/library/dd394711.aspx
Reply With Quote
  #4  
Old 14-07-2009
Member
 
Join Date: Jan 2009
Posts: 143
Re: How to pass MVC data from attribute to controller

Here is also one more example of how the attributes to the controller has been passed.

Code:
public ActionResult Details(int id)
          {
               ViewData["categories"] = from c in _dataContext.MovieCategories 
                         select c;
               ViewData["movies"] = from m in _dataContext.Movies 
                         where m.CategoryId == id
                         select m;
               return View();
          }
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to pass MVC data from attribute to controller"
Thread Thread Starter Forum Replies Last Post
Network Diagram - Configure to show Forward Pass/Backward Pass m3lyssa Microsoft Project 9 30-08-2010 04:57 PM
How to Pass data from one page to another in PHP? Aldous Software Development 3 25-09-2009 03:21 PM
How to Pass Data Between Two MDI Forms Brunoz Windows Software 3 25-09-2009 11:19 AM
lose data on a raid 0 by changing the controller? Dr.pter Hardware Peripherals 4 16-03-2009 06:33 PM
What is difference between pass by value & pass by reference in java? Baran Software Development 4 25-02-2009 07:15 PM


All times are GMT +5.5. The time now is 01:31 AM.