Questions tagged [html.renderpartial]

24 questions
80
votes
5 answers

asp.net MVC partial view controller action

I'm very new to web app development and I thought I would start with recent technology and so I'm trying to learn asp.net as-well as the MVC framework at once. This is probably a very simple question for you, MVC professionals. My question is should…
yogibear
  • 14,487
  • 9
  • 32
  • 31
7
votes
3 answers

ASP.NET MVC - Can a Partial View have a controller?

When I'm in a View and I call @Html.RenderPartial("MyPartialView", MyObject) Can I set it up so that this partial view has a controller which is called when RenderPartial gets called?
dev.e.loper
  • 35,446
  • 76
  • 161
  • 247
5
votes
1 answer

Mvc Render Action/Partial to Response Output

Although @Html.RenderPartial calls write and returns void, it is still writing to a StringWriter/StringBuilder. Is there a way to render directly to the ResponseStream? Can this be done with a custom IViewEngine that implements render like PdfView…
Steve
  • 1,995
  • 2
  • 16
  • 25
4
votes
1 answer

Difference between Html.RenderPartial and Html.Render

I am new to asp.net and im have a page that i want to show as a partial view. The page is in a div tag ,like this
Html.RenderPartial("view",Model)
and im doing the same thing with Html.Render but it works just with RenderPartial. Does…
Bafla13
  • 132
  • 2
  • 11
3
votes
3 answers

What's the overhead of including RenderPartial in an MVC3 page

I am trying to optimize my code as much as possible. I use a lot of partial files like this: @if (Model.PageMeta.Sidebar == PageMetaSidebar.Small) { Html.RenderPartial("_SmallSidebar"); } .. .. .. Can someone tell me if there is a performance…
3
votes
1 answer

Render Partial View with Object Model using jquery / Ajax

My current code looks like { // some code @Html.Partial("~/Views/AdminUser/Main.cshtml", Model.AdminUserModel) } however, i need this to instead be an ajax call. How do I do an jquery ajax call where the model is…
Kevin Scheidt
  • 95
  • 3
  • 10
2
votes
2 answers

How to put a Partial View into a div in JavaScript (with jQuery)

I have ,MyPartialView.cshtml':
some content
an 'index.cshtml':
and an 'index.js'. The 'index.js' should do sth like: $('mainDiv').html($('#partialDiv')) to put the partial view into the main…
1
vote
2 answers

RenderPartial not rendering inside of div

Hi I'm having some issues understanding how MVC 3 and razor work. Basically, I have a view that's rendered with Html.Render partial. basically, I'm trying to render the contents or a partial view inside of div like so.
1
vote
2 answers

Html.RenderPartial - Render Partial View located in another folder

I have my view 'Create.cshtml' in folder Views-Department. I want to use partial view which is located in folder on root, 'CommonViews' with the name '_EnterpriseStructure.cshtml'. I am using syntax RenderPartial …
pkp
  • 11
  • 2
1
vote
1 answer

RenderAction or RenderPartial dynamically

I have this view that has the following code: @model ComPost.Core.CommandsAndQueries.Contract.DataContract.DepositDetailDTO @section scripts {
1
vote
1 answer

calling partial view from another controller inside @Html.RenderPartial

The directory structure is: controllers -> HomeController, TableController views -> home -> index.cshtml views -> Table -> Navigate.cshtml The index.cshtml corresponds to the index…
1
vote
1 answer

Html.RenderPartial Works but Html.RenderAction not working (is blank) and no errors or exceptions

Here is what i am trying Layout WebApp Name
Michael
  • 33
  • 1
  • 6
1
vote
2 answers

What's the best way to cache a user control or its associated data in asp.net mvc

I am in the middle of implementing an application using ASP.NET MVC and would love to cache the data passed to user controls or the output rendering on some user controls that I render using the Html.RenderPartial, that way I don't have to query the…
samiq
  • 2,954
  • 1
  • 29
  • 29
1
vote
1 answer

asp.net mvc3: How to pass parameters from controller to a partial view which is designed to be called by RenderPage?

I have one partial view which will be called both by @RenderPage and a controller's action as well. Here is the code to call it from another view with @RenderPage which passes parameters with the PageData[]: @foreach (var subTree in…
cheny
  • 2,545
  • 1
  • 24
  • 30
1
vote
0 answers

Issue with partial view and viewmodel in separate assembly

I am developing an MVC solution and I want to have a plugin option for some partial views I am creating. I have separate assembly for each plugin that contains the PartialView as an embedded resource and the viewmodel class that it references. I…
1
2