Click here to Skip to main content
14,970,493 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi 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
**VIEW**

HTML
<h3>Report</h3>
<div>
    <table>
        <tr>
            <td>ServiceLine</td>
            <td>@Html.DropDownList("ServiceLine", null, new {id="ServiceLine"}) </td>
        </tr>
    </table>
</div>
<div>
    <h2>List</h2>
    <div>
        @Html.Partial("PartialView")
    </div>
</div>


This is what I have got in controller

C#
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
Updated 7-May-13 0:23am
v2

1 solution

I have write an article about Load Partial View as Partial View Result using Ajax in ASP.NET MVC.Try the below link
http://fromjamitoothers.blogspot.in/2013/03/load-partial-view-as-partial-view.html[^]
Hope this helps you
   
v2

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




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900