Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MVC partialview
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**
 
    <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
 
    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 Barrow149.6K
v2

1 solution

Rate this: bad
good
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
http://fromjamitoothers.blogspot.in/2013/03/load-partial-view-as-partial-view.html[^]
Hope this helps you
  Permalink  
v2

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

  Print Answers RSS
0 OriginalGriff 277
1 Maciej Los 210
2 BillWoodruff 195
3 DamithSL 195
4 Richard MacCutchan 178
0 OriginalGriff 5,130
1 DamithSL 4,197
2 Maciej Los 3,670
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,821


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 7 May 2013
Copyright © CodeProject, 1999-2014
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