renderpartial

Html.RenderPartial call from masterpage

Here is a scenario: Let's say I have site with two controllers responsible for displaying different type of content - Pages and Articles. I need to embed Partial View into my masterpage that will list pages and articles filtered with some criteria, and be displayed on each page. I cannot set Model on my masterpage (am I right?). How do I...

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 method, but it's not offering me the functionality I'm looking for. ...

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 extension method 'RenderPartial' accepting a first argument of type 'System.Web.Mvc.HtmlH...

Pass Viewdata as member from other viewdata to RenderPartial makes the first null

The strongly typed SearchViewData has a field called Colors that in it's turn is a ColorViewData. In my /Colors.mvc/search I populate this viewData.Model.Colors based on the given search criteria. Then, based on several factors, I render one of a set of user controls that are able to render itself with a ColorViewData. So I will end up w...

rails: how to update a has_many :through relation via jQuery?

Hey guys! Sorry, if this is a noobish question, but I'm just getting started with Rails and jQuery. I have the following scenario: I have 3 classes: contacts, companies and contact_company_joins (ccj). For all three classes I created models, controller and views. Obviously, contacts and companies are connected via the join-table ccj (...

conditional formating in rails partials

I am rendering a rails partial and I want to alternate the background color when it renders the partial. I know that is not super clear so here is an example of what I want to do: Row One grey Background Row Two yellow background Row Three grey Background Row Four yellow background sorry stackoverflow seams to prevent the b...

ASP.Net MVC and RenderPartial w/ relative paths

I've been playing around with ASP.NET MVC and had a question. Or maybe its a concern that I am doing this wrong. Just working on a lame site to stretch my wings a bit. I am sorry this question is not at all concise. Ok, here's the scenario. When the user visits home/index, the page should show a list of products and a list of articl...

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 properties without explicitly assembling the ViewDataDictionary across multiple lines. It...

ModelFactory in ASP.NET MVC to solve 'RenderPartial' issue

The 'RenderPartial()' method in ASP.NET MVC offeres a very low level of functionality. It does not provide, nor attempt to provide a true 'sub-controller' model *. I have an increasing number of controls being rendered via 'RenderPartial()'. They fall into 3 main categories : 1) Controls that are direct descendants of a specific ...

asp.net mvc renderpartial with null model gets passed the wrong type

I have a page: <%@ Page Inherits="System.Web.Mvc.View<DTOSearchResults>" %> And on it, the following: <% Html.RenderPartial("TaskList", Model.Tasks); %> Here is the DTO object: public class DTOSearchResults { public string SearchTerm { get; set; } public IEnumerable<Task> Tasks { get; set; } and here is the partial: <%@ Cont...

Is it possible to put just a rails form element in a partial?

My app has a select box for users to choose a "venue". This select box is, as you would expect, in a form. I also have an action somewhere on the page that creates a new venue via AJAX. After the new venue is created, I would like to updated the venue select box to reflect this. My solution was to put the select box in a partial and ...

Load partial from class library

Is there a way to load partial views from a class library? I would like to pull out the common parts from several websites to make them easier to maintain. Currently I render my partials with (for example) <%Html.RenderPartial("~/Views/Search/_searchBlock.ascx", ViewData);%> This is file based, but when creating a class library, th...

ASP.NET MVC Returning Partial View as a full View Page

I have a number of partial views that are used to render media in different formats (embedded video mainly). I now have a requirement that has me displaying these videos inside an iframe. Is there a way that I can return a minimal HTML page with the partial views embedded in it? ...

using a usercontrol on aspx page in MVC using partial view

I have Dropdown and on click of a button, I want to display data in the usercontrol the below code is not working as expected. <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <% using (Html.BeginForm()) {%> <%=Html.DropDownList("CarMake", (SelectList)ViewData["CarMake"])%> <input...

Are there any cases in which Rails overwrites controller instance variables on render :partial?

Are there any cases in which Rails overwrites controller instance variables on a render :partial call performed in a template? For example, let's say we have: controller def my_action @widget = Widget.find(params[:id]) end view my_action.html.erb Hi there. <%= render :partial => 'my_helper' %> That's it, that's all. view _my_he...

ASP.NET MVC RenderPartial Handling Client Side IDs

I have taken on an MVC project that has a view that displays several partial views using Html.RenderPartial("ClientDetail", model); Html.RenderPartial("PlanSummary", model); The problem I have is that inside of these partial views, controls with the same id are being generated. Both of the above partial views have this line: Html.Hid...

How does the Html Helper, RenderPartial, work? How can I implement a helper that can bring in content from a partial view?

When you use Html.RenderPartial is takes the name of the view you want to render, and renders it's content in that place. I would like to implement something similar. I would like it to take the name of the view you want to render, along with some other variables, and render the content within a container.. For example: public static ...

Partial with Multiple Variables

Hi I am new to rails and need some guidance. I am sure I am misunderstanding something obvious. I would like the user name of the person who leaves a comment to show on the view page. I have a partial that goes through the collection of comments for the particular object for example a school. I can't figure out how to pass that user va...

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? ...

Render partial for model with nested attributes in another model

I have a rails application that models a house. house contains rooms and rooms have nested attributes for light and small_appliance. I have a calculator controller, which is how end users will access the application. My problem is that I can't get the partial for adding rooms to render and submit correctly from calculator. The initial ...