asp.net-mvc

Using ASP.NET MVC From Visual Web Developer Express 2008

I was wondering if there's a way (even a manual one) to setup an ASP.NET MVC project with unit tests under Visual Web Developer Express 2008 SP1. ...

asp.net mvc put controllers into a separate project

I'm just learning asp.net mvc and I'm trying to figure out how to move my controllers into a separate project. Typically when I have designed asp.net web apps before, I created one project for my models, another for my logic, and then there was the web. Now that I'm learning asp.net mvc I was hoping to follow a similar pattern and pu...

Create an ActionLink with HTML elements in the link text

In an ASP.NET MVC view I'd like to include a link of the form: <a href="blah">Link text <span>with further descriptive text</span></a> Trying to include the element in the linkText field of a call to Html.ActionLink ends up with it being encoded (as would be expected). Are there any recommended ways of achieving this? ...

asp.net mvc + activerecord saving object graph

I'm using asp.net mvc and I'm trying to create a new Employee, in my form I use the Html.DropDown(...) to display a list of Departments to select from. Ideally I would like MVC to just figure out which Department was selected (Id property is the value in dropdown), fetch it and set it in the incoming Employee object. instead I get a nu...

How do you return error messages from AJAX calls using jQuery and ASP.NET MVC?

If I have an ASP.NET MVC controller action that is called from a jQuery .ajax call that needs to throw an error, how do I do so? I know I can create a JSON object and pass it an "error" property, but what if the response from the .ajax call isn't expected to be JSON but HTML instead? ...

What are some options for implementing search on a ASP.NET MVC website?

I am currently finishing up my first ASP.NET MVC application and would like to implement site searching. What are some options for allowing a visitor to search the site? ...

Passing data from Controller to a User Control View with ASP.NET MVC

I have a View class (OrderView.aspx) which shows the details of an order (Account Name, Order Date) as well as a list of order lines via the Repeater control. Each order line is represented by a User Control View (OrderLineView.ascx) which shows the details of the order line (Item Name, Quantity, Price). I have a model object called Or...

ASP.NET MVC and .NET 3.5 SP1 on Windows Server 2003 and IIS

I am writing a website for a client who says their servers run the following: "Windows 2003 with the latest IIS". What do I need to do to get them ready for hosting my ASP.NET MVC website built with .NET 3.5SP1? ...

Is it possible to give an ASP.NET MVC User Control a different Model than the Page

I have an order page that is being rendered from a Model object (Order) with a few properties. One of the properties of the Order object is public List<OrderItem> Items { get; set; }; and the other is public List<OrderComment> Comments { get; set; }; My main page is declared like this: public class OrderView : ViewPage<Order> I...

Control serializer in JsonResult aka Json function in ASP.Net MVC?

Is there a way to configure what JSON serializer is used when returning JSON via the JsonResult in the controller: public ActionResult SomeJsonFunction() { var x = SomeModelCode.SomeModelFunction(); return Json(x); } It looks like the default is the JavaScriptSerializer. I would love to be able to use the DataContractJsonSerializ...

Is menu link suppression a responsibility of the view or the controller?

In ASP.NET MVC, I am building a site with the requirement that the main menu (appearing on every page) should remove the hyperlink for an entry (leaving just the text) if the current page is the one linked to. The menu html is defined in the master page for the site, but is currently populated from the ViewData passed by the controller....

UrlEncode of link ids with ASP.NET MVC HtmlHelper extension methods

I have actions that take string id parameters that are based on a username which can include characters that require encoding, for instance "user?1" If I use ActionLink() to generate the links, passing the string without encoding, it generates a link like this: http:\\localhost\controller\action\user?1, and the action gets passed "user"...

Does the Model Binder in ASP.NET MVC Beta Support List<T>?

Take the example classes below. I want to display the customer and two addresses (from a LIST) on a form. Does the model binder in MVC beta support this or will I have to write my own custom binder? public class Customer { public string FirstName { get; set; } public string LastName { get; set; } public List<Address> Addre...

How do you trigger the "error" callback in a jQuery AJAX call using ASP.NET MVC?

This is related to my question on how to handle errors from jQuery AJAX calls. Several responses suggested that I use the "error" callback to display any errors from a jQuery AJAX call. I was wondering how to do that using ASP.NET MVC. Is there a way for my controller action to return an error that would be accessible from the "error"...

Mapping individual buttons on ASP.NET MVC View to controller actions

I have an application where I need the user to be able to update or delete rows of data from the database. The rows are displayed to the user using a foreach loop in the .aspx file of my view. Each row will have two text fields (txtName, txtDesc), an update button, and a delete button. What I'm not sure of, is how do I have the update...

Where is the <%=Html.RadioButtonList()%> extension in MVC beta?

Is there any reason why there isnt a radiobutton list helper in the core MVC beta? There's a dropdownlist, but no radiobuttonlist. I know that I can easily create an extension method to do surely this is a core thing? ...

Django apps equivalent in ASP.NET MVC?

I currently develop with Django, but want to be ready when a future client inevitably requests a site done in ASP.NET MVC. While most of the structure and flow of ASP.NET MVC is more or less identical to Django and RoR, the one part I'm not sure about is the Apps methodology Django employs to make code reuse easier. Is there an equival...

nhibernate burrow and ASP.Net MVC

I using nhibernate burrow for long conversation. I am preparing to migrate project to ASP.NET MVC, but burrow doesn't support MVC. I trying to change Burrow to work via MVC. But I have no idea what is the best way to do this. I am not sure that HTTP Module is a good way. I think about ActionFilters to initialize conversation. Thanks ...

How can I create a view that has different displays according to the role the user is in?

I want to create a view that has different displays according to the role the user is in. Should I create a different view for different roles or should I check the roles on the Veiw page itself rather than in the actions? How would I check the role on the view page? ...

ASP.NET Dynamic Data & Membership (Roles)

hi Everyone, I am trying to setup roles in a dynamic data website.. the problem is that i cant set it by simpy doing this. <location path="List.aspx"> <system.web> <authorization> <allow roles="Administrators" /> <deny users="*" /> </authorization> </system.web> </location> so even when i lo...