Results 1 to 4 of 4

Thread: How to pass MVC data from attribute to controller

  1. #1
    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.

  2. #2
    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)

  3. #3
    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

  4. #4
    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();
              }

Similar Threads

  1. Replies: 9
    Last Post: 30-08-2010, 04:57 PM
  2. How to Pass data from one page to another in PHP?
    By Aldous in forum Software Development
    Replies: 3
    Last Post: 25-09-2009, 03:21 PM
  3. How to Pass Data Between Two MDI Forms
    By Brunoz in forum Windows Software
    Replies: 3
    Last Post: 25-09-2009, 11:19 AM
  4. lose data on a raid 0 by changing the controller?
    By Dr.pter in forum Hardware Peripherals
    Replies: 4
    Last Post: 16-03-2009, 06:33 PM
  5. Replies: 4
    Last Post: 25-02-2009, 07:15 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,750,529,721.71502 seconds with 16 queries