partial-views

ASP.Net MVC partial views keeping their model state?

This is probably again a newbie question. When I create an ASP.NET MVC2 application, an Account Controller with an Action LogIn is created like this: [HttpPost] public ActionResult LogOn(LogOnModel model, string returnUrl) { if (ModelState.IsValid) { if (MembershipService.ValidateUser(model.UserName, model.Password)) ...

Rails/3 - Render partial based on state of instance variable?

Struggling with this one a little bit. I have two parameter search form, when both fields match it returns the row into @person: So what i want to happen is render one partial before the search, another one if a person is matched and another one if a record is not found. Where does this logic go and what can I check against? def inde...

Which is better for showing lots of small values in ASP.Net MVC - HTML helper or partial view

We have a small Asp.Net MVC project which displays a report of several tens or hundreds of rows of data. Each row is represented by an object on the view models. Currently we are showing the rows like this: <table> <tr style="text-align:center"> <th>Name</th> <th>Item count</th> <th>Stat 1</th> <th>St...

when should i use partial views in asp.net mvc?

I ve gone through sample asp.net mvc nerd dinner application... But still cant understand the point where and when should i go for partial views? Is it similar to usercontrols in webformw? Note: It would be helpful to see a partial view in action... Any sample... ...

How to use partial in views with different alias MIME ?

Im using 2 different sets of views for 2 different user's roles. Im using register_alias : Mime::Type.register_alias "text/html", :basic in the controller: class SomeController < ApplicationController def index # … respond_to do |format| format.html # index.html.erb (advance) format.basic # index.basic.erb ...

Rendering a combo box in a partial

In my project i have this combo box, and it works perfectly: <%= collection_select @project, @project.clients.id, @project.clients, :id, :name %> My simple and quick question is, how can i render this in a partial, I'm using this and it's not working... <%= render :partial => "clients", :collection => @project.clients, :locals => {:p...

MVC partial View jQuery datepicker removing previous date pickers

I have a page where I am trying to add Children to a Parent object. On the page, I have a link, "Add Child", that calls an ajax get, returning a partial view with textboxes for the Child. In the sucess, i am doing a function to add the results to the innerHTML of a div. On the partial view, I have a textbox for the Birthdate, named "B...

jQuery Validator 'form' is null or not an object from $(document).ready

This question is in relation to A Previous Question, however, since it was a completely different I decided to start a new question. In my code, i have a $(document).ready that calls a function addChild. It works just fine, unless I call the function more then once. If I call 2+ times in the $(document).ready, it will give the error: ...

MVC Ajax not loading Partial View in div, loading new page

Hello, I'm currently working with MVC 1.0 and have never worked with AJAX before and only have limited experience (started a little more than a week ago) with ASP.Net MVC. I'm trying to setup a table (that's built / is in a partial view) that's populated with information from a db that allows a user to quickly add pr remove records into...

Proper way of building MVC ActionLink

I've got an MVC ActionLink like so (which works just fine) <%: Html.ActionLink(user.UserName, "Details", "Users", New With{.id = user.ID, .slug = Replace(user.UserName," ","-")}, nothing)%> But since it's not "recommended" to do string manipulation in the View, I'm wondering how I could build a custom Html ActionLink to do the string ...

ASP.NET MVC 2 Multiple PartialView Forms fieldname conflict

I have a ASP.NET MVC 2 webpage in which I render multiple PartialViews of the same type. Each partial view contains a Ajax-form for posting smth. The form consists of: an input: EditorFor(m => m.content) the validation for the input: ValidationMessageFor(m => m.Content) The problem is that because there are more than 1 of these forms...

Asp.Net MVC Ajax refresh of table contents

Currently I have a table on my page which I need to refresh using Ajax. I was intending to render the table in a partial view and then just call an MVC render-partial update, which would have been nice and simple. However, I've since added a bunch of sorting/filtering controls in the header of the table. I would now like to refresh the ...

Ajax Partial Update with Partial View not working in ASP.NET MVC2

Hi, I've ran into some trouble trying to get partial updates to work in ASP.NET MVC2. (I think) I followed the tutorials I found online pretty closely, but the Ajax part isn't working. The controller does what it's supposed to do without errors, but the page doesn't update itself. When I refresh the page I can see the result of my actio...

How to use the Zend Framework partial view helper outside of a controller or view?

I would like to create a custom class that will generate an HTML email. I want the content of the email to come from an "email view scripts" directory. So the concept will be that I can create an HTML email view script the same way I would create a normal view script (being able to specify class variables, etc), and the view script would...

ASP.NET MVC render partial from the POST method

Problem I have Telerik TabControl and each tab content is a partial view. Everything works smoothly when request is GET: // // GET: /ProductVersion/Translations public ActionResult Translations(Guid id) { VersionEditTabViewModel model = CreateTranslationsViewModel(id); return PartialView("Translations", model); } Now ...

In Ruby on Rails, how to make HTML as partials in one file and Javascript in another file to be included last?

A lot of time, in a partial, the HTML (or ERB or HAML) as well as the Javascript is in one file, so when the main file includes these partials, the HTML will be intermixed with Javascript code. However, it is said that for fast page content display, all Javascropt code should be placed at the end of the HTML file. In this case, is ther...

Is it i possible to prevent certain PartialViews from being served if requested directly?

I'm working on a site that has routes to actions which render Partial Views. A lot of these partial views are components which together make up a complete page. For instance on a search page I'm working on has a text box, a list of tabs, and a Table. Seach of these can be accessed with a URL similar to /Search/SearchPanel /Search/Tab...

ASP.Net MVC2 Custom Templates Loading via Ajax and Model Updating

I have a view model with a collection of other objects in it. public ParentViewModel { public int Id { get; set; } public string Name { get; set; } public List<ChildViewModel> Child { get; set; } } public ChildViewModel { public int Id { get; set; } public string FirstName { get; set; } } In one of my views I pas...

Rails Render Helper Not Rendering

As the title says, one of my helper functions to render partials isn't rendering correctly. def render_contact_list @contact_groups = ContactGroup.find(:all, :conditions => ["user_id = ?", current_user.id]) @contact_groups.each do |contact_group| @contacts = Contact.find(:all, :conditions => ["group_id = ? and O...

select_tag multiple and partials

I'm having a problem with some pesky select_tags, I can get them to show data fine on the new but when it comes to edit, they don't show up, here is the code I have at the moment. I think I need to use include? but I don't know where to put it. This is what I have at the moment for the new <% @data = Code.find(:all, :conditions => "sec...