asp.net-mvc

Custom model binder for model inner property

My model is like this public class MyModel { string ID {get;set;} string Title {get;set;} MyOtherModel Meta {get;set;} } How to define custom model binder for type (MyOtherModel) so when default binder binds MyModel it calls custom model binder for 'Meta' property. I registered it in App start like: ModelBinders.Binders[typ...

ASP.NET MVC 1 custom model on registration page, confirm password not getting populated

I've been playing around with the default MVC 1 site, adding some fields to the registration section that are used to create a secondary object in the database at sign up time. I've created the view model including the username, email, password and passwordConfirm properties, along with a few others. I then added the type to the inherit...

ASP.NET MVC Html.Element ?

Is there a generic Html.Element? I would like to be able to do this: Html.Element<AccountController>("IFrame", "elementName", new { src = c => c.ChangePassword }) ...

ASP.NET MVC 1 using persistent cookie, intercept loading of user data to include other logic

I am using Forms Authentication for the default MVC site, and i also have a custom DB table with extra user information (LINQ2SQL). I have some logic that loads the extra data from the db when the user logs in manually on the site, but the same logic is not executed when the users data is loaded from the persistent cookie stored when the...

ASP.NET MVC - Secure Temporary Storage of Credit Card Data

I have a checkout process for a shopping cart that is currently storing credit card data in the session for retrieval once the user finalizes the purchase. The purchase process is set up such that the user inputs the credit card, views a confirmation page, and then finalizes the order. The confirmation and finalization actions are the on...

How can I better handle this situation in ASP.NET MVC concerning my Partial Views?

I have a single view which has a menu on the left hand side and a container on the right hand side that is rendered from one of several partial views. Right now I'm running into a situation like the following "Index" view: <div class="container"> <div class="leftHandMenu"> // various dynamic menu items </div> ...

How do I render an alternate child view in MVC?

I'm new to working with MVC so please don't assume I know anything. I am picking up a project that has much already written in MVC and I am trying to add some things to it. On one View there is a line <% Html.RenderAction("List", "Image", new { id = Model.JobId, all = true }); %> I see a List.ascx under the Image directory. I see ...

linq image saving problems

I have an object that has a property: [Column] public Binary Image { get; set; } When the object is saved the first time every this is OK, but when it is modified I get an exception on SubmitChanges: The data types image and varbinary(max) are incompatible in the equal to operator. What might be the problem here? ...

MicrosoftMvcAjax breaks jQuery validate plugin

Possible Duplicate: jquery validate & ajax.beginform I'm trying to use the jQuery validate plugin to validate a form (Ajax.BeginForm). When I enter invalid data on the form the error messages are shown but the form will submit anyway. How do I stop MicrosoftMvcAjax from submiting an invalid form? Thanks in advance ...

Asp.Net MVC - RenderPartial - Create in a List view

I got a page that lists all my articles (Articles/List.aspx). I also got a control that create article (Article/Create.ascx). I will like that my List.aspx page that's render the Create.ascx to be able to create article. I know that in MVC, the preferred approach is one page by action. But in this case I need to do that. It's a design...

Site update, testing was fine, after deployment, again fine, once user load increases, FAIL?

We are using ASP.NET MVC with LINQ to SQL. We added some features and tested them all to perfection on our QA box. We are using Windows Server 2003 and SQL Server 2005. So when we pushed out changes to the Live web server we also used Red Gate SQL Compare to push new database changes to the LIVE database. We tested again between the few ...

Generate an Excel XML document in Asp.net MVC Web Site

I have an ASP.Net MVC site that generates a Microsoft Excel 2003 XML formatted spreadsheet. The spreadsheet looks good, the controller and views both work, but the file won't open in Excel. It opens in the browser because it is an XML document. I tried changing the ContentType to be the Excel XLS format (application/excel) and that ma...

Validation Runner for Castle (or NHibernate) with Buddy Class Support

I'm using the wonderful xVal library for setting up client side validation of rules defined server side in ASP.NET MVC. In my implementation I need buddy classes since I'm extending classes already defined by entity framework. (I recognize that MVC2 may make all this moot, but I'm staying in MVC1 until 2 goes live). The DataAnnota...

How do I Check previous data in LINQ?

I have a collection of data that checks if there is a change in a particular field to get the sum for another column. Total = Details.Where(s=>s.indicator != *prior indicator before this...).Sum(s => s.amount); ...

ASP.net mvc, generic/dynamic controllers and Type.GetType: how can I keep my URLs pretty?

Using information from some of the questions here on generic views, I have created an MVC app that reads .dlls from its own /bin directory and builds the UI on the fly. InputBuilder partial views helped a lot. I also made a ControllerFactory, after the advice from here and elsewhere. My problem is, while everything is working OK and ref...

How can I do an eager load when I don't know the name of the property I want to load?

I have a generic repository and when I'm using a DoQuery method to select objects from the database, I need to load some of the related entities in order to not get nulls in the place of the fields that are foreign keys. The problem is that the repository is generic, so I do not know how many properties need loading or what their names ...

How do I get a linq to sql group by query into the asp.net mvc view?

Sorry for the newbie question, but I have the following query that groups parking spaces by their garage, but I can't figure out how to iterate the data in the view. I guess I should strongly type the view but am a newbie and having lots of problems figuring this out. Any help would be appreciated. Public Function FindAllSpaces() ...

Tips for Developers moving from ASP.NET Webforms To ASP.NET MVC

What should developers moving from ASP.NET Webforms watch out for when they move to ASP.NET MVC? ...

What are the PropertyValuesString and PropertyValuesBinary fields in the aspnet_Profiles table for?

I figured the PropertyValuesString was for the value part of what is usually the Key-Value pair of these types of object. But then where does the PropertyValuesBinary field come in if you've already put the value into the PropertyValuesString? Both fields are non-nullable so I need something to put in each. What's the difference betwee...

"Browse with..." option not available on ASP.Net MVC Project

I'm sure this is a simple misunderstanding but I'm trying to change the default browser in Visual Studio 2010 from Firefox (my machine's default) to IE so that VS will stop debugging when the window closes. Based on ScottGu's post on the subject, I'm expecting a "Browse with..." option when I right-click on an aspx page in my MVC app; b...