partial-views

asp.net MVC Handle Partial Postback Response

I have multiple pages containing the same partial view. The partial contains a form that posts to an action. After a post I want to return to the page I was on before the post. What's the best way to do this? Example: Partial View: form post action = note/create/ Pages page1: products/index/ page2: customer/details/ page3: order/d...

collection counter in rails partials

Hi All, I'm rendering a partial in a collection like this : <%= render :partial => 'issues/issue', :collection => @issues %> Inside the partial, I want to render a element unless it's the last in the collection. I could of course, render the partial like this <%= render :partial => 'issues/issue', :collection => @issues, :locals =>...

How do I call javascript on host MVC page when ajax call in partial view is complete?

I have an Asp.net MVC partial view that is used for searching. It does an Ajax call to retrieve results. Once the results are retrieved and displayed in the result pane, the user can click on a link in any of the result rows to select one of the search results. When the user clicks on a link to select one of the search results, it will m...

Determining the name of current view within a partial view in ASP.NET MVC

I have a partial view in my test ASP.NET MVC application. This view is responsible to display application menu buttons. I want to change the color of button which is currently active page. Currently I have written something like: <ul id="menu"> <% var activeClass = (string)(ViewData["currentPage"]) == "Home" ? "activeMenuButton" : ...

ASP.NET MVC - Combine Json result with ViewResult

Can I return a Json result that contains also a rendered view? I need it to return the new ID of a submitted form along with its HTML and some other properties. Also that can be helpful when I need to return two (or more) view results from one action inside a Json object. Thanks! ...

MVC - Dynamically loading Partial Views

I'm trying to dynamically load partial views into a view by passing the list of paths for the partial views I want and then calling RenderPartial on each. This seems to do the trick. The problem comes in when I try to pass the model to the partial view. Since I'm dynamically loading them, I don't exactly know which model to pass for t...

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

ASP.NET MVC 2 - When To Use Templates vs When to Use Partial Views

One of the new features in ASP.NET MVC 2 Preview 1 is support for the concept of Editor Templates and Display Templates which allow you to pre-define how a given object will be rendered for display or editing with a simple HTML helper call: <%=Html.EditorFor(customer => customer) %> <%=Html.DisplayFor(customer => customer) %> This is ...

ruby on rails logic for a partial in a layout

I have a sidebar that is going to have some logic in it, similar to how a view talks to a controller. Where do I put the logic in for the partial? Do I create a new controller for the layout and put it in there? The layout is for logged in users, like a dashboard. The dashboard is going to have a sidebar that shows the same dynamic cont...

Return Partial View As JsonResult

I have a partial view that returns an HTML chunk of list items that gets appended onto an unordered list via an AJAX call. This all works fine. However, once I receive the HTML back from the AJAX call, I would like to be able to set some properties on each of the list items via JQuery. In order to do that, I'm assuming that I need to ...

How to group partial shared views for specified controllers?

Is it possible to tell ViewEngine to look for partial shared views in additional folders for specified controllers (while NOT for others)? I'm using WebFormViewEngine. This is how my PartialViewLocations looks at the moment. public class ViewEngine : WebFormViewEngine { public ViewEngine() { PartialV...

How would you get this done with Telerik asp.net mvc extensions? accordion, tabs and ajax

I know this probably is a fairly complicated question but... heres my case: I want to build my UI using teleriks jquery ui extensions. My idea was to create a sidebar with an accordion and the main content with tabs. The accordion having as content a list of links. Each link mapping to correspond to an item of the accordion. For instanc...

asp.net MVC: embedded object editing

Hi, I'd like to embed an instance of object A inside object B. I have already an action and an editing view which renders a form for object B. I made it a strongly typed partial view accepting B. I am dealing with the Create action now, so I do b = new B(); b.A = new A(); Now I'd render the form for B, and then call the partial view fo...

How can I reload a div with a PartialView in ASP.NET MVC using jQuery?

I have a div with a partial inside somewhere on the page. I have a event on a button. How could i write a Javascript that takes the div and reloads it and also reloads the partial view. I have this in another view. But i can't do it like this now. But i need the same thing to happen only execute by a jquery not directly in the page. C...

Rendering the field name in an EditorTemplate (rendered through EditorFor())

I'm currently building the Admin back-end for a website in ASP.NET MVC. In an ASP.NET MVC application, I've started using the 'EditorFor' helper method like so: <div id="content-edit" class="data-form"> <p> <%= Html.LabelFor(c => c.Title) %> <%= Html.TextBoxFor(c => c.Title)%> </p> <p> <%= Html.Label...

ViewUserControl containing ViewPage

Is there a way to get a reference for the ViewPage that contains a parital view from the partial view ?? ...

Loading Partial View from JQuery not showing in MVC.

Hi I am having problem getting my partial view to render in ASP.Net MVC 1.0 when I load it with JQuery. I have a controller like: public ActionResult Index() { return View(_invoiceService.FindAllInvoices()); } public ActionResult InvoiceSearchResults() { return PartialVie...

Rendering two Partial Views on the same Page

I can display a list of all customers and I can display a list of all orders and I would like to take this further. I would like to render two partial views on the same page to show customer details and orders relating to that customer. <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mv...

How do you build a Single Page Interface in ASP.NET MVC?

Hi all, I want to build a webapplication with a "Single Page Interface", using ASP.NET MVC. I have searched if this was at least possible and I think the answer is: not by simple means (reading http://msdn.microsoft.com/en-us/magazine/cc507641.aspx#S2 second-last paragraph; that article is from May 2008, though). I found other example...