views:

80

answers:

2

Heya,

I'm fetching a page using ajax (jquery) and appending certain data to the Requests query string to let the server know it shouldn't render the entire Page, just the view in question to the output buffer. I'm having no luck though, I can detect when the page needs to be rendered partially, but everything I've tried so far (including stuff like return PartialView()) isn't working.

Any ideas?

Thanks in advance.

A: 

Why don't you just create a partial view News.ascx. If there are circumstances where you really need to render a new page complete with master page etc, then create a different page and corresponding action for that, for example NewsPage.aspx and:

public ActionResult NewsPage()
{
    return View(); 
}

NewsPage.aspx can then use Html.RenderPartial to reuse News.ascx in the full new page view.

<% Html.RenderPartial("News", ViewData) %>

Thinking about it, adding data to the requests to determine whether to show the full view, as opposed to having two different actions, seems a little dirty and prone to abuse by potential attackers.

s1mm0t
Thing is I'd like to have the ability to render any one of my actions partially, with this approach I'm going to have alot of essentially duplicate actions/views to accomplish that.
Fauxide
A: 

This seems to be working

Fauxide