partial-views

Nested link_to_function / insert_html causes javascript errors

Im using a link_to_function / insert_html to insert a partial into the page. Everything works fine, until i add another link_to_function / insert_html into the partial that is being rendered into the page. All of a sudden the outer link_to_function link stops working and throws this error: "missing } after property list" [Break on ...

asp.net MVC partial with dynamic inherits class?

Hey guys, I have a partial view that is shared between two controllers and I'm trying to find a way to change what it inherits from depending on which view it is being called from or which controller. IE: my current partial is started like so: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<MVCProject.Controllers.P...

Spark view engine - passing model to partial view

It would like to iterate through list and render partial view for each element: <for each="Element elem in elements"> <render partial="partialViewName"> </for> How should I pass elem to partial view? <render partial> doesn't have additional parameters. I can use html.RenderPartial, but I would like to use Spark syntax. Is it po...

PHP equivalent for RoR template partials/collections

Hi, I'm trying to figure out the most efficient way to implement RoR-style partials/collections for a PHP template class that I'm writing. For those who aren't familiar with rails, I want to iterate over a template fragment (say a table row or list item) located in a separate file. I want to do this without resorting to eval or placing a...

How to pass two sets of data to a view?

How do I go about passing two sets of Data to a view in ASP.NET MVC? I've tried a couple of things and neither have worked so I've come to the simple conclusion: I'm doing it wrong. I have 2 queries: callRepository.FindOpenCalls() and callRepository.FindAllMyCalls(user) and I want to out put both sets of data to one view via 2 partia...

How to return Nested PartialViews (including their javascript) from an AJAX call in ASP.Net MVC

I have created a treeview of Categories using nested partial views: my Index page (that displays the treeview): <div> Category Menu: <input type="button" value="1" name='selectCat_btn' /> <input type="button" value="2" name='selectCat_btn' /> </div> <!-- Treeview --> <% Html.RenderPartial("ItemCats_UL", Model); %> <div id="CatSe...

Seemingly simple MVC partial view question

I am trying to display my data (images) in two columns of a table in my partial view. The code below does not seem to work as it displays each image in its own row. What am I missing? <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <%@ Import Namespace="ULS_Site.Models"%> <%var alternating = false;%> <table> <% f...

Zend Framework how to get the number of item in the loop ? partialLoop partialCounter and ?

Hello everyone, I want to to make a particular processing for the last item of a partialLoop, the documentation mention about $this->partialCounter but not the variable with the total number of items ... <?php if( $this->partialCounter == $mysteryvariable -1 ): ?> I am missing something I think ... cannot get my hand on that varia...

Specifying partial view path using T4MVC

Hi all, I am using T4MVC in our ASP.NET MVC Project. I have a statement like this in my view <% Html.RenderPartial(MVC.SomeController.Views.PartialViewName); %> Which was previously like this <% Html.RenderPartial("../SomeController/PartialViewName"); %> Previously it was working fine, but after I specified the partial view using...

Passing two different models to a view with ASP.Net MVC

I'm trying to set up a view that displays two different models. For example, I have a "Details" view that shows details of a customer; which I am passing my customer model. I also want to have a section on the page under the customer information (I was thinking about using a partial view) that lists their pets (for a vet practice). I ...

Why is this render :partial line iterating my collection twice?

Given these relationships: class Account < ActiveRecord::Base has_many :employments has_many :people, :through => :employments accepts_nested_attributes_for :employments end class Employment < ActiveRecord::Base belongs_to :account belongs_To :person end I'm trying to list the employment records for an account: <% form_for...

Rendering Partials from One Controllers View to Another Controllers View in Rails

I have a view for a controller called "show". Inside that view, i want to render the contents of another controller's view - and obviously, the logic for the form on that view to talk to the controller it belongs too. How do I do this? I am fairly new to rails and I'm not 100% confident with the framework yet. You could almost consid...

Adding a script reference to the html head tag from a partial view

How do I inject a script tag such as <script src="somejsfile"></script> or <script type="text/javascript>some javascript</script> into the head tag of a page from a partial view? ...

Using RenderAction() and posting back to sub-controller action

I have parent view that also renders sub-controller action using RenderAction() (that returns a PartialView). An example is a front page with Login partial view (inputs: username, password, remember and action: login) Execution process GET for Home/Index - also displays my login control that has its login pointing to sub controller Us...

Reusable Content Box Data In ASP.NET MVC?

If I create a PartialView for a box that holds a header, image and content what is the best way to store the content without using a database? Example: TurboTax I doubt the content for the boxes in the sidebar are stored in a database but to make reusable code it would be beneficial to create the structure in a PartialView and populate...

Accessing Page URL from within Partial View in MVC

I have a page which has a partial view included within a div called test. I may request more content to be placed within this div by receiving back a PartialViewResult. I want to be able to obtain the url of the page (i.e. what is shown in the address bar) from within the PartialView code but when I use Request.Url, it gives me the URL...

[ASP.NET MVC] What would cause a partial view to suddenly not be found?

I'm baffled. My site randomly throws the following error: System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.InvalidOperationException: The partial view '/SiteUserMenu' could not be found. The following locations were searched: /SiteUserMenu at System.Web.Mvc.HtmlHelper.Fi...

HTML Helpers and Partial Views

If I have say a Partial View called MypartialView and I have a HTML Helper called "MyHTMLHelper" how can I return a partial view from the helper? My requirement is that sometimes I'd like to render a PartialView on it's own and other times I'd like to render it with another partial view, or a slab of text or something. So I thought I c...

Can a partial view be used to do Ajax item updates?

I have a table built from a list of defect codes. Can part of each row load a sub-table item complete with submit buttons? Sample table: <table><tr> <th>Code</th><th>Description</th> <th>Impact to your customers</th> <th>Impact to your associates</th> <th>Save</th> <th>Save Errors</th></tr> Where the first 2 columns are populated f...

ASP.Net MVC run JavaScript in PartialView when loaded using Ajax.ActionLink

Hi, I've got a question regarding ASP.Net MVC. I'm using an Ajax.ActionLink to load a PartialView. In this partial view is a javascript function I'd like to get called. However I can't figure out how to make this happen. I've tried using AjaxOptions { OnSuccess="functionInPartialView" } when I set the Ajax.ActionLink but for some ...