renderaction

Exception handling with RenderAction Asp.Net MVC

We are using renderaction provided by MVC futures. We've noticed that HttpExceptions in child action methods are not propagated to the parent action. Even though a fragment has failed, we still see the parent request resulting in a 200, and this throws our error handling for a toss. Any suggestions on how this could be handled? Thanks, ...

When Is It Appropriate to Use Html.RenderAction()?

Hi Guys I'm a little bit unsure about when it's appropriate to use Html.RenderAction() to render my Views and when not to. My understanding is that because it's not an 'official' component of ASP.NET MVC it's bad practice to use it, and its original intention was for reusable widgets that don't exist in any specific Controller context. ...

Asp.Net Mvc 2 - RenderAction List with a create

First, I use Asp.Net MVC 2 RC 2. What I want to do is to list a comment view and below this view being able to add comment (with validations). For example, something like when you add comment in stackoverflow. Except that my page should work with or without javascript enabled. So to solve that problem I use the new RenderAction and it ...

ASP.NET MVC - Ajaxified RenderAction

I am happy with what the RenderAction() function does. However, I'd like to ajaxify the loading and storing of data in the partially rendered action, so that everything happens in one page. Imagine the following case: I have an article details view where there's an "Add comment" link beneath the content of the article. When it's click...

Html.ActionLink in Partial View

Hi. I am using the following code in my master page: <% Html.RenderAction("RecentArticles","Article"); %> where the RecentArticles Action (in ArticleController) is : [ChildActionOnly] public ActionResult RecentArticles() { var viewData = articleRepository.GetRecentArticles(3); return PartialView(viewData); ...

Html.RenderAction<MyController> - does not have type parameters

Hi, I'm trying to use RenderAction in the following way: '<% Html.RenderAction( x => x.ControllerAction() ); %>' as seen here: http://devlicio.us/blogs/derik_whittaker/archive/2008/11/24/renderpartial-vs-renderaction.aspx and here: http://eduncan911.com/blog/html-renderaction-for-asp-net-mvc-1-0.aspx but I keep getting an erro...

RenderAction not finding action method in current controller in current area

I'm creating an ASP.NET MVC 2 (RTM) project that uses areas. The Index action of the Home controller of one area needs to use RenderAction to generate a sub-section of the page. The action called is also defined in the same Home controller. So the call should just be: <% Html.RenderAction("List") %> However, I get an exception: A pub...

Asp.Net MVC2 RenderAction changes page mime type?

It appears that calling Html.RenderAction in Asp.Net MVC2 apps can alter the mime type of the page if the child action's type is different than the parent action's. The code below (testing in MVC2 RTM), which seems sensible to me, will return a result of type application/json when calling Home/Index. Instead of dispylaying the page, the...

Renderpartial or renderaction

have an action that generates active vacancies. The code is below; public ViewResult OpenVacancies() { var openvacancies = db.GetActiveVacancies(); return View(openvacancies); } I want to use this list on several pages so i guess the best thing to use is html.renderaction (please correct me if i ...

How to add a weather info to be evalueated only once???

Hi everybody! In a ASP.MVC (1.0) project i managed to get weather info from a RSS feed and to show it up. The problem i have is performance: i have put a RenderAction() Method in the Site.Master file (which works perfectly) but i 'm worried about how it will behave if a user clicks on menu point 1, after some seconds on menu point 2, a...

MVC2 Client validation with Annotations in View with RenderAction

I'm having problem with client side validation on a View that renders a dropdownlist with help of a Html.RenderAction. I have two controllers. SpecieController and CatchController and I've created ViewModels for my views. I want to keep it as DRY as possible and I will most probably need a DropDownList for all Specie elsewhere in the n...

using mvc futures renderaction modelstate.isvalid is never false

I'm using MVC 2 and MVC Futures 2.0.50217.0. I started with a view which repeatedly calls RenderAction(...) to include some external content implemented by another controller within my application. This is from the containing view: <% foreach (var subModel in Model.SubModels) { %> <h3><%: subModel.Title %></h3> <% Html.RenderAc...

asp.net mvc - RenderAction problems

I'm not quite sure I understand what Html.RenderAction() does. I've just noticed one weird behavior when using it: In View/Contacts/Edit.aspx I used Html.RenderAction("ModalAddNote") which contains form for adding Notes for Contact. This is for ajax usage (it is opened in modal dialog). Problem occurs when I create method ModalAddNote: ...

Is html.renderaction code smell

I've recently started a new job where I've been thrown into a bug fixing role on an under development ASP.Net MVC application. I'm a big fan of using an MVC approach for web apps and built some hefty production apps on Maverick.Net starting back in 2004/2005 however this is my first time using the ASP.Net MVC framework for anything other...

.net Html.RenderAction returns binary instead of HTML. Huh?!

I'm not sure exactly what I'm doing wrong here. I have an action which returns a partial view: public class SharedController : BaseController { public ActionResult StudentPoll() { WAM.X2O.FuelUpToPlayContext db = new WAM.X2O.FuelUpToPlayContext(WAM.Utilities.Config.ConnectionString); WAM.X2O.StudentPoll ...

ASP.NET MVC2 RenderAction makes parent loose ViewModel context

I'm my Project Browser page I have 2 sub-elements that warrant their own controller (and not simply a user-control) - Upload and FileBrowser, and so I've added them using Html.RenderAction(Action, Controller, param). The problem however, is that the Browse page requires ProjectViewModel, where Upload uses UploadViewModel, etc. etc. So b...

Using friendly_id in a catch all route

Hi all, I want to be able to use friendly_id in a catch all route to render the page that it fetches. for example http://localhost:3000/business would render controller "pages" action"show" with id "business" without leaving the url above. The aim of this is to avoid things like localhost:3000/pages/business and make shorter urls. I ...

asp mvc: show object details on a jquery dialog

Hi, Suppose I have a list of dinners. This list will present the users with, location, data and some other relevant info. Since that there's a lot of people attending, I want a button on each dinner that opens a jquery dialog that will show the people that will attend. What I accomplish until now: On each dinner on the list I have th...

ASP.Net MVC reusable form as RenderAction or RenderPartial

I'm looking for a best practice for embedding a form on multiple pages as a partial view. I have a contact form I'm looking to embed on multiple pages on a site. Usually, the form would be on a contact page and the contact model could be the model for the view and use data annotations for validation. However, the view is already strongl...

ASP.NET MVC 2 controller not cached

Hi All, I have amaster page that calls render action: <% Html.RenderAction("CategoryList", "Category", new { selectedCategoryId = Model.selectedCategoryId }); %> and the action looks like: [ChildActionOnly] [OutputCache(Duration = 10, VaryByParam = "none")] public ActionResult CategoryList(int? selectedCategoryId) { CategoryLi...