Click here to Skip to main content
11,927,190 members (49,259 online)
Rate this:
Please Sign up or sign in to vote.
See more: MVC partialview
I am using MVC Structure. I have to create a report which can be filtered by drop downs. I am thing to use a partial view to display report.
HEre is the structure of the page I want to achieve.
On top of page, there will be some drop down lists.
Below these will be page for report.

when user changes the options from dropdownlist, the report will be filtered.

I have two questions
1. How to render partial page.
2. How to refresh partial page through ajax/jquery. I want to do this on client side.

I have checked online, I am rendering page as shown in code below

            <td>@Html.DropDownList("ServiceLine", null, new {id="ServiceLine"}) </td>

This is what I have got in controller

public ActionResult PortfolioReport(char serviceLine)
    //Department List

     var serviceLines = Enum.GetValues(typeof(SogetiDepartments)).Cast<SogetiDepartments>().Select(v => new SelectListItem
        Text = v.ToString(),
        Value = ((char)v).ToString(),
     foreach (SelectListItem item in serviceLines)
         if (Convert.ToChar(item.Value) == serviceLine)
             item.Selected = true;

     ViewBag.ServiceLine = serviceLines;
    return View();

Any kind of help is appreciated.
Posted 7-May-13 1:15am
Edited 7-May-13 1:23am
Keith Barrow155.5K

1 solution

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

Solution 1

I have write an article about Load Partial View as Partial View Result using Ajax in ASP.NET MVC.Try the below link[^]
Hope this helps you

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

Advertise | Privacy | Mobile
Web02 | 2.8.151126.1 | Last Updated 7 May 2013
Copyright © CodeProject, 1999-2015
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