asp.net-mvc

How to handle localization/string values in an ASP.NET Web MVC project?

I am trying to put all of my strings into the resource file, something I do for all my Windows and Web Forms applications. Works great when it comes to changes string values for labels and/or localizing the application. I tried adding the string values to my Web MVC project, but cannot seem to access the Resource file from the inline c...

MVCContrib grid and posting back with model binder

The contents of my MVCContrib grid come from the Model on a strongly typed View. When a post is made, the contents of the grid are not in the model object when it returns to the controller. I can see that this is because the grid renders as just a table with text in cells. Is there something I can do so that when the post occurs, the li...

ASP.Net MVC Routing - using same pattern for different controllers

Say I have an ASP.Net MVC site with products and categories, and I want these urls... Products: Fruitshop.com/super-tasty-apple Fruitshop.com/squishy-orange Fruitshop.com/worm-infested-apple Fruitshop.com/megaorange Categories: Fruitshop.com/apples Fruitshop.com/oranges For each product/category in the database, I save the slug ...

Rhino Commons UnitOfWork and ASP.NET MVC Controller seem to be caching parameters

I am using Rhino Commons UnitOfWork in my controller methods. The first request retrieves the data and displays it correctly. My problem is when I change the parameters in the URL they are not passed to the controller. The values from the previous request are used. My controller method is listed below: public ActionResult List(i...

AutoMapper flattens Domain Models but does it do the opposite? If not, what does?

I've been reading up on AutoMapper because of a response to one of my earlier questions here. It says that AutoMapper flattens complex domain models, but I need something that does the opposite. I need to wire up my view models (flattened domain models) to the complex domain models so that I can quickly transform a view model into a doma...

How to Handle Variable Number of Parameters in Route Method

I want to use the same post Action method for multiple number of input fields. How can I get hold of all the parameters passed to MVC engine (in addition to the method parameter)? e.g. Both these list of values should be handled by the method below 1,A,A 1,B,A,A [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(int id) { //...

ASP.net MVC: Getting Required Roles for Login?

Hi, is there any generic way to get the role which is required for some particular action? In Detail my problem is, that I have e.g. 2 roles "User" and "Admin" and an action with the following: [Authorize(Roles = "Admin")] public class AdministrationController... If the user is not logged in, he gets the login screen. That's ok. Whe...

Strongly typed access to result-set from Linq Join - to display in MVC view

I am new to the MVC/Linq party (coming from Java). I know that I can use something like the following to get strongly typed access, but what about if I want to use a join in my linq query? public void IQueryable<Product> GetItems(int CategoryID) { ...linq query... }enter code here ...

c# execute code inside custom attribute

Possible Duplicate: Why does my .NET Attribute not perform an action? Hi, This may soundlike a very dumb question and I don't know what is possible here as all the "custom attribute" tutorials on the net are pretty much the same and they don't address what I want to do. I've seen some code out there where code is written inside...

Page refresh in MVC

Hi all, I'm studing Microsoft ASP MVC framework. Here is a problem I encounterd: I have a view with DropDownList containning a list of countries and another DropDownList for states. The OnChange event post the form back and then the controller sends data to the states drop down which should update. But the second DropDownList doesn't ch...

Need Help building Custom Html Helper for Asp.net MVC

Hi I been playing around with some custom html helpers and I now I am trying to make one that I can use for jquery AJAX UI Tabs. So to do ajax tabs you need to have this format in your html code <div id="example"> <ul> <li><a href="ahah_1.html"><span>Content 1</span></a></li> <li><a href="ahah_2.html"><span>Con...

asp.net mvc keeps overriding text/html content-type with .wml

I'm developing an website which is to be viewed on mobile (cellphone) devices. I'm just using plain HTML 4.01, nothing special at all. The pages render fine on all the mobile browsers we've tested, except for Nokia Series 40 1-5th editions. On closer inspection, it seems that IIS is automatically rendering the html with the content-type ...

How can I use nHibernate to get a small subset of object properties for list view

I am using ASP.NET-MVC and nHibernate for the first time. Great tools, but big learning curve! I have a list view of objects that are quite large (each has about 60 properties). In the list view I am only using about 10 of these properties. Performance is not too bad, but it seems a waste to fully hydrate these objects. What is the reco...

ActionLink within RenderAction

Hello, I'm using RenderAction to include the output of several "components" in my view. But everytime I use RenderAction calls to ActionLink within the nested action produce wrong routes. (Same for RouteLink.) If the action is called directly the correct routes are produced. So I call the action several times in the index action of my ...

asp.net mvc tutorial project

I'm having some trouble getting the code to work from the book "Pro ASP.NET MVC Framework." I'm on page 96 for those that may have worked through this book before. When I run the code I get the following: System.Data.SqlClient.SqlException was unhandled by user code Message="Invalid object name 'Products'." Source=".Net SqlClient ...

asp.net mvc with ioc --> avoiding constructor soup with BaseController

Hi, I have a BaseController that I'm using to house my cross cutting concerns for an MVC project. However, this means that my Controller has 3 dependencies: public BaseController (IUserService u, ITenantDetailsService t, ISiteConfiguration c) The side effect of this is that my constructors for each derived controller are awash with...

Multiple Dynamically Populated Drop Down Lists

I've got a page which will have about ten drop down lists which are generated from my SQL database. What's the best way to populate them? I was going to use a stored procedure with LINQ to return multiple result sets, but it seems a bit overkill. Is there another way of doing it? Using HtmlHelpers or something like that? Seeing as tho...

asp.net mvc and recaptcha action

When a user submits a form, i'd like to show/redirect to the captcha page intermittently ( based on some custom rules ) and if validated, then execute/commit the first action Is there a way of doing this using the ActionFilter ? or any other way ? ...

How to get drop-down list value?

Hi, my first question here.. :) Let's begin with the code... my page is <form id="form1" runat="server"> <% using (Ajax.BeginForm(null)){%> <%=Html.DropDownList("DdlScelta",MVC.Models.SelectLists.ConventionIdsSelectList, "Select by this list")%> <%=Ajax.ActionLink("Show the Data", "SetData", new AjaxOptio...

IIS6 Wildcard Mapping Security Concerns?

We're are looking to utilized extensionless URL's for the first time in our organization. We've requested our sys admins add a wildcard mapping to IIS6 so all requests get processed through the asp.net. They are pushing back, citing security concerns. I don't have enough information about potential security issues with the wildcard ...