locked
Creation of view with dynamic Model in asp.net mvc RRS feed

  • Question

  • I am new Asp.Net Mvc . I am doing a sample application for Blogging . I tried to create Partial view forArchives for categorizing Post according to date .

    Month/Year(count)
      Post 1
      Post 2
    Month/Year(count)
      Post 1
      Post 2

    In controller
    [ChildActionOnly]
        public ActionResult Archives()
        {
            var post = from p in db.Posts
                       group p by new { Month =p.Date.Month, Year = p.Date.Year } into d
                       select new { Month = d.Key.Month , Year = d.Key.Year , count = d.Key.Count(), PostList = d};
    
            return PartialView(post);
        }

    Please help me write View for this Action with this Month, Year , Count and collection of Post .
    • Moved by Caillen Thursday, January 23, 2014 2:19 AM
    Wednesday, January 22, 2014 10:35 AM

Answers

All replies