asp.net-mvc

Where can I find a good NHibernate and ASP.NET MVC Reference Application

Where can I find a good NHibernate and ASP.NET MVC Reference Application? I downloaded S#arp and this seemed to be a lot more than I needed (IOC and CodeGen via T4). I might work my way up to this later, but I need something smaller at first. Any simple examples? I just want to pick up how NHibernate Session handling works in ASP.NET MV...

Does any one know where the RenderAction HtmlHelper is in ASP.NET MVC in RC1

Does anyone have an alternative to the RenderAction HtmlHelper seeing as it's gone in RC1. I need to render a user control but use a different controller to populate the user control view. How might this work now? ...

How to implement search features in ASP.NET MVC applications

I can imagine many ways of implemeting search features in an ASP.NET MVC application but since I can't find much documentation I was wondering if you have any common pattern, technology or common approach to implement search features in a ASP.NET MVC application (similar to stackoverflow). Some technologies that I have in mind are: SQL...

How do I create rotating ad blocks in ASP.NET MVC?

How would you implement a rotating ad-block with each page refresh, similar to what SO does, using ASP.NET MVC? Do you think they have a session variable with what ad index we are currently viewing and cycle it each request or something else? ...

What should my JSON string look like in my Action in MVC?

Hi, in .net mvc my action looks like: public ActionResult TestAjax(string testID) { return Content(@"{first: ""1"", second : ""2""}"); } In my javascript I am doing: function(data) { alert(data.first); } I am getting [object Object] as the output, why is that? Is my JSON string wrong? ...

If you had to pick a free CMS to integrate with ASP.NET MVC what would you pick?

I am looking for starting from scratch with a CMS - specifically one that will integrate well with ASP.NET MVC. preferably somebody has written Html Helpers for me must be easily editable by an idiot must give me really nice clean HTML must be able to store simple strings, or full blown documents would really prefer SQL server as the ...

What is the best practice for using ASP.NET MVC to render lots of html or text files?

I have a lot of html pages, but I don't know how to display them through the asp.net mvc view. I buid a view as my template and use asp.net mvc to insert html into the template and then render it. But the question is that I must use FileStream to read the raw html-based files into memroy and then put it into view template, like ViewDa...

MVC & Date Formatting

Hi, Where in an MVC based architecture should the date formatting (long/short/time/no-time/UK/US) live? I want to be able to specify long/short/time/no-time on a per-field basis - i.e. DateOfBirth doesn't care about time, but CreationDate might. Using ASP.NET MVC, there doesn't seem an easy way to do it in the View, which makes me won...

How do i add a codebehind to as asp.net mvc view?

Im experiencing some craziness that I just can't figure out.. ive created the following class: public abstract class AbstractView<T> : ViewPage<T> where T : class which gives me some useful helpers and im using it in my views like this: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="Project.Web...

Which action is executing as a strongly typed object.

I would love to be able to get some strongly typed way of knowing which action is executing. To clarify im doing AOP where I only allow access to a given action if the user has rights for that action. The problem with using a string for determining which rule to check for, is that if some developer renames an action, I wont get a comp...

ASP.NET MVC - Form Submission, Retrieve Database ID, and Redirect

I currently learning ASP.NET MVC . I wondered if it is possible when a form is submitted to the get the id of the new record and then redirect to a new page with the new record id? The information is entered into the database correctly, but I’m not sure how to get the id? For example, complete a new customer details form and then redir...

ASP .Net MVC CSS classes on HTML.Controls

I think I'm missing something relatively simple here, but I'm trying to find a way of applying a CSS class to my controls within my views. I'm using the <%= Html.SubmitButton("Submit", "Edit Plot")%> style method of doing this. Short of putting divs around these elements and applying the styling, is there anyone way of getting access...

ASP.NET MVC URLs in a JSON request

Warning: The question refers to the RC version of ASP.net MVC. Problem is solved in ASP.net MVC 1.0 I have a page that requests some JSON from an Action on my controller and then fills a table with that data. In my JSON reponse, I'm including an anon object that contains some fields. One of those fields is a URL to another control...

Alternative to using the OnLoad event in an ASP.Net MVC View?

I'm creating a simple test application so I can see how ASP.Net MVC works for what we deal with on a daily basis. We use 3rd party controls from Developer's Express, and we will continue to use them. If they absolutely do not work in ASP.Net MVC, then we will not use ASP.Net MVC. With that said, someone has found a way to make it work. ...

ASP.NET MVC partial views and redirecting

I have a partial view called Login.ascx that has my login boxes that I include on a number of pages throughout my site. It works fine when the information is correct but I'm trying to do validation so if the login info is incorrect, I want to redirect the user back to the view they were in before to show them the login errors. What is th...

Context switching in an ASP.NET MVC view?

Is there a cost to using server tags in an ASP.NET MVC view? In other words, is the a context switch when you jump out of markup and into a <% %> block and what is the penalty paid in this instance? ...

Get the fully qualified url for a controller and action?

Hi, What's the correct way to get the full url (including protocol and domain) for a controller and action? I need this to be able to send links to pages via email. I was hoping to just use Url.Action() and concatenate it onto the current server hostname from Request.Url. However, it seems that Url.Action is context sensitive and so wi...

Adding a controller factory to ASP MVC

I have a design idea for a large project at work and I think I have it figured out but would really love to get some feedback on a) the idea in general, and b) my proposed implementation. The basic idea is simple: I want to create an ASP MVC application that can be extended in the future with additional controllers and views without hav...

Validating dynamically created fields in ASP.NET MVC.

I have the following form in an ASP.NET MVC view: <%= Html.ValidationSummary() %> <% var fields = ViewData.Model; %> <% using (Html.BeginForm("Dynamic", "Candidate")) { %> <% foreach (var field in fields) { %> <label for="<%= field.FieldName %>"><%= field.FieldName %></label> <%= Html.TextBox(field.FieldName, field.Val...

ASP.NET MVC automatically decoding JSON-encoded parameters from AJAX

When my JavaScript code uses AJAX to call an ASP.NET MVC method, it passes values in JSON. For example: var request = new XMLHttpRequest(); request.open("GET", "http://www.awesome.com/DoSomething?param1=%22some%20string%22&amp;param2=1234", true); // parameter string created with JSON.stringify or var request = new XMLHttpRequest()...