asp.net-mvc

Implementing layouts in a multi-tenant site

Hi, I'm after a bit of advice on how to handle a multi tenant site in ASP.NET from a UI perspective. What I want to be able to offer is a choice of layouts to the client i.e. Layout 1: Navigation horizontal at the top. Search results in a table in the middle. Some text at the bottom. Layout 2: Navigation vertical on the left. Some ...

Using the ASP.NET membership provider database with your own database?

Hello everybody, We are developing an ASP.NET MVC Application that currently uses it's own database ApplicationData for the domain models and another one Membership for the user management / membership provider. We do access restrictions using data-annotations in our controllers. [Authorize(Roles = "administrators, managers")] This ...

Passing an array of object in json format from view to controller

public Class Object1 { int property1 string property2 datatime property3 } // post method public virtual void ControllerAction1(Object1[] listOfObjects){ } I am tryign to pass an array of type object1 to the controller method. The client side sends the array in json format. But parameter listOfObjects is null. ...

How to properly develop and deploy features for existing asp.net applications on IIS

My question actually consists of multiple questions. I'm frequently reading about companies who deploy a small subset of features for a select amount of customers using the live "database". Ruby on Rails and its ecosystem have deployment tools and database migrations to deploy or rollback such features in a live production or staging env...

Entity Framework - extra dynamicly calculated properties for business objects/models (ASP.NET MVC)

Let's say that I have Customer model with following fields: Id, FirstName, LastName. I want to present list of Customers in List View. For this I use my service method which return List to iterate in view. But now I want also to display some additional information for each customer, for example credit. This information is not stored in ...

Want to create a action filter to force Url to be using SSL

I want to create a action filter that will check the url, and if its not using Ssl, redirect to the same page but with SSL. What is the best way of doing this? Should I just check the RawUrl, and scan the string for https, and if its not there then do: context.Response.Redirect(context.Request.RawUrl.Replace("http:", "https:")); ...

LINQ to Entites: How and where to use OnPropertyChanging or ReportPropertyChanging events?

I'm trying to determine when a certain field is updated, and perform an action when the field changes. I'm using a custom binder for the class, and the first call in the binder is to base.BindModel(), at which point the original value is gone. When do the OnPropertyChanging and ReportPropertyChanging events get called? Is there any wa...

JQuery Uploadify not not showing in IE7

I am using Uploadify http://www.uploadify.com/ in my asp.net mvc application however it works great but when using IE7 it doesn't show up I am hoping someone has some insight as to how to fix this. I did look through thier forums and there are several problems in IE7 posted but nothing related to what my problem is and with a solution. ...

Display list of values separated by commas without trailing comma

I have an ASP.Net-MVC app using LinqToSql. I have a subcontracts table, a service_lines table and a mapping/link table Service_lineToSubcontracts which contains the subcontract_id and service_line_id. On the subcontract view, I'd like to list the corresponding service lines. This works, but has a trailing comma. <% foreach (var sls i...

asp.net mvc trying to use session but controllercontext is null

hi, i am trying to store an object in session.. in one controller, i create the object and put it in session. MyObject _o = new MyObject(); Session["MyObject"] = _o; MyObject _oo = (MyObject)Session["MyObject"]; // added for testing purposes, is not null i can retrieve the object from session just fine from within same controller. ...

How to set the master page's html title from within a controller's action or view page?

I have a controller's action and view page that uses a master page. The master page has the html title section like: <title>this is the page's title</html> How can I access this section from within my controller's action (preferably) or my action's view page? ...

Subsonic 3 - Object of type 'System.UInt64' cannot be converted to type 'System.Boolean'.

Hi! i´m using subsonic 3 trying convert a SQL2008 project to MySQL. when the projects try execute this LINQ query : public IQueryable<Marca> SelecionaMarcas() { try { return (from mc in _db.Marcas where mc.Ativo == true ord...

How to manipulate values in LINQ query without "Explicit construction of entity type ### in query is not allowed when trying to modify value" error

Is it possible to change a field value from inside a LINQ select query for use in an ASP.NET MVC app? For example, if a query returns a field with value "foo," I want it's output to be "bar" instead. Essentially, I want LINQ to create this TSQL statement: CREATE PROCEDURE GetSpecialCaseOfMyObject ( @param varchar(10) ) AS S...

Page containing Microsoft Chart Control returns Service Unavailable

I have a frustrating problem with an asp.net mvc view containing the Microsoft Chart control. When I request the view containing the control I get the following error. Service Unavailable HTTP Error 503. The service is unavailable. When I run the project under the visual studio 2008 dev server it works fine. When I deploy th...

ASP.NET: Using MVC partial view in web forms

I've got a regular ASP.NET web form page and am pasting in a <%= Html.Partial(...) %> that I took from an MVC view page. What do I need to do to this web forms .aspx to get the Html.Partial to work? I've put this at the top of my web forms .aspx page: <%@ Import Namespace="System.Web.Mvc" %> <%@ Import Namespace="System.Web.Mvc.Html" ...

Is it possible to use different view engines for different views in the *same* ASP.NET MVC website?

I'd like to experiment with NHaml. Can I use the NHaml view engine for a few of my views, without having to convert the entire application (or create a new prototype application)? ...

MvcSitemap or routefile, or both?

I find the MvcSiteMapProvider very interesting. But will I somehow be able to generate, autoload (or something in that category) the route (declaration) for my website? ...

SiteMapProvider practice: load all?

I'm using a custom sitemapprovider (SQL) which enables me to add the pages from the database. I also have a node called products. There are several categories which contain other categories or products. I currently load ALL products and categories in the sitemap. (along with products there are more business objects which have a custom s...

Determining which form input failed validation?

I am designing a creation wizard in ASP.NET MVC 1 and instead of posting back each step, I'm using javascript to toggle the display of the different steps divs. This is a quick sample of the code, just to explain. <% using (Html.BeginForm()) {%> <fieldset> <legend>Fields</legend> <div id="wizardStep1"> <% Html.RenderPartial("Cre...

What's the point of the red underline highlighting in ReSharper 5 for ASP.Net MVC?

I recently upgraded to using ReSharper 5 (currently in beta). I noticed that in ASP.Net MVC projects, ReSharper underlines in red all of the return statements inside a controller: I personally find this pretty annoying because it looks like an error. Clicking on the underlined text doesn't offer any help (ie, a lightbulb). I don't see...