Questions tagged [renderpartial]

The concept of rendering only a specific part of any UI. May also refer to the .NET `RenderPartialExtensions.RenderPartial` method or the Ruby on Rails `PartialRenderer`

The concept of rendering only a specific part of any UI. May also refer to the .NET RenderPartialExtensions.RenderPartial method or the Ruby on Rails PartialRenderer

391 questions
1079
votes
13 answers

Html.Partial vs Html.RenderPartial & Html.Action vs Html.RenderAction

In ASP.NET MVC, what is the difference between: Html.Partial and Html.RenderPartial Html.Action and Html.RenderAction
Ghooti Farangi
  • 19,926
  • 15
  • 46
  • 61
276
votes
10 answers

Render partial from different folder (not shared)

How can I have a view render a partial (user control) from a different folder? With preview 3 I used to call RenderUserControl with the complete path, but whith upgrading to preview 5 this is not possible anymore. Instead we got the RenderPartial…
Boris Callens
  • 90,659
  • 85
  • 207
  • 305
233
votes
8 answers

Render Partial View Using jQuery in ASP.NET MVC

How do I render the partial view using jquery? We can render the partial View like this: <% Html.RenderPartial("UserDetails"); %> How can we do the same using jquery?
Prasad
  • 58,881
  • 64
  • 151
  • 199
203
votes
7 answers

renderpartial with null model gets passed the wrong type

I have a page: <%@ Page Inherits="System.Web.Mvc.View" %> And on it, the following: <% Html.RenderPartial("TaskList", Model.Tasks); %> Here is the DTO object: public class DTOSearchResults { public string SearchTerm { get;…
Andrew Bullock
  • 36,616
  • 34
  • 155
  • 231
104
votes
1 answer

Html.RenderPartial giving me strange overload error?

I made a test partial page named _Test.cshtml and put it in the same directory as my view that will be calling it, here it is:
hi
And in the calling cshtml view, I simply put: @Html.RenderPartial("_Test") Which gives me the…
naspinski
  • 34,020
  • 36
  • 111
  • 167
97
votes
6 answers

Razor: @Html.Partial() vs @RenderPage()

What is the appropriate way of rendering a child template? And what's the difference? Both seem to work for me. And why does @Html.RenderPartial() no longer work?
Evgenyt
  • 10,201
  • 12
  • 40
  • 44
34
votes
4 answers

passing parameters to my partial view?

I am calling my partial view like this: <% Html.RenderPartial("~/controls/users.ascx"); %> Can I pass parameters to partial view? How will I access them in the actual users.ascx page?
mrblah
  • 99,669
  • 140
  • 310
  • 420
30
votes
3 answers

How to include JavaScript from a Partial View in ASP.NET MVC3

I would like to be able to provide a way for partial views to include JavaScript code / files at the bottom of a view. This would enable partial views to include any JavaScript files that they depend on. For instance, if I wanted to write a partial…
26
votes
5 answers

Shorthand for creating a ViewDataDictionary with both a model and ViewData items?

Is there any way to create a ViewDataDictionary with a model and additional properties with a single line of code. I am trying to make a RenderPartial call to a strongly-typed view while assembling both the model and some extra display configuration…
patridge
  • 26,385
  • 18
  • 89
  • 135
26
votes
4 answers

RenderPartial a view from another controller (and in another folder)

I two database entities that i need to represent and i need to output them in a single page. I have something like this Views Def ViewA ViewB Test ViewC I want to ViewC to display ViewA, which displays ViewB. Right now i'm using…
George Silva
  • 3,454
  • 10
  • 39
  • 64
24
votes
3 answers

Using Html.RenderPartial() in ascx files

I'm trying to use Html.RenderPartial in acsx file and I'm getting an error: Compiler Error Message: CS1973: 'System.Web.Mvc.HtmlHelper' has no applicable method named 'RenderPartial' but appears to have an extension method by that name.…
takayoshi
  • 2,789
  • 5
  • 36
  • 56
19
votes
4 answers

Pass ViewData to RenderPartial

I'm trying to call this method: RenderPartialExtensions.RenderPartial Method (HtmlHelper, String, Object, ViewDataDictionary) http://msdn.microsoft.com/en-us/library/dd470561.aspx but I don't see any way to construct a ViewDataDictionary in an…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
15
votes
5 answers

Pass Parameters in render - Rails 3

I've seen a couple questions on this but haven't been able to solve it... I'm trying to pass a parameter while rendering a partial (similar to domainname.com/memory_books/new?fbookupload=yes) Right now, I use this line: <%= render :partial =>…
user749798
  • 5,210
  • 10
  • 51
  • 85
13
votes
3 answers

C# Render Partial View Without Controller

I am having trouble using "RenderPartialViewToString" without a controller class. I am currently having to create HTML within application start up which requires making a model, making a view and turning the view in to a HTML string. Within my view…
Lemex
  • 3,772
  • 14
  • 53
  • 87
13
votes
3 answers

ASP.NET MVC Beta 1 - where is Html.RenderPartial?

I'm just in the process of upgrading my Preview 5 application to Beta 1, and I'm nearly there save for this one error when trying to render a control: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'RenderPartial' and no…
tags2k
  • 82,117
  • 31
  • 79
  • 106
1
2 3
26 27