asp.net-mvc-2

How to generate hash or use encryption to secure the keys in an asp.net mvc application?

EDIT 1 : I think I was not clear myself before and hence could not word it better. So, I am creating a system where I am providing page content to another system via IFRAMEs. A user will login to the other system and that system will set their apiKey and userKey in a cookie on my system so that access will be granted i...

SQL Server 2008 R2 installed, still cannot open version 661?

Getting an error running a sample MVC2 site because of DB version errors. I ran the installer for SQL Server Express 2008 R2 and it finished, I rebooted. Try to run the site again and see the same error. Downloaded/ran R2 installer and chose upgrade but there is nothing to upgrade... is something wrong in my VS2010 or windows in general?...

DataAnnotations validation in Custom Model Binder

I have written a custom model binder for List in my MVC project however I am now stuck in how to get this binder to validate against my DataAnnotations validation attributes. I have found some posts on the interwebs that talk about similar scenarios, but I haven't been able to find anything that works for my particular scenario. Model...

MVC2 Using Unity IoC - How are controllers resolved?

I have a question concerning how the Unity container I have set up is resolving controller dependencies. I've been searching around for an explanation of this but haven't found anything that is real clear on the subject. And maybe the answer is staring me in the face... Take a look at the following code that I'm sure many MVC guys hav...

Help with asp.net mvc reflection and properties

I need a way to dynamically populate this query... to avoid repeating the same query which I will have to do about 20 times public decimal percentage_of_property(string property) { var total = Routines().Where(r=>r.property==true).Count(); return (decimal)100 * total / routines_total(); } This obviously doesn't work... but I p...

ASP.NET MVC 2 and the tablesort v2 jquery control

Hopefully someone can help, I've been playing with ASP.NET MVC 2 for a learning project. Recently I wanted to introduce some more advanced effects, one of which being sortable tables. Given that I have a number of other jquery controls, using a jquery control seemed a good idea! I selected tablesorter v2 and set about adding it to my ...

jQuery AutoComplete does not refresh when new data entered into text box

I type the words "How do" and it pops up a list, and returns matches on "How do". I stop for a second, and continue typing " I make a sandwich?" for instance. It pops up on the "How do" but does not refresh the results when I continue typing. How do I get it to refresh once data has been typed more? Here's my code: $(document).ready(...

HTMLHelper RadioButton

Hello I'm new in .net Family and i've been looking asp.net webpage and following the MVC tutorials the problem is I'm using LinQ to Sql (2005) model and C# and i need to put a radioButton to know if a date must be initialized or not how do i do this using html helpers ?? ...

.NET MVC Custom Date Validator

I'll be tackling writing a custom date validation class tomorrow for a meeting app i'm working on at work that will validate if a given start or end date is A) less than the current date, or B) the start date is greater than the end date of the meeting (or vice versa). I think this is probably a fairly common requirement. Can anyone poi...

javascript regex for validating email list with ASP MVC 2 data annotations

I am trying to use ASP MVC 2 data annotations to validate a semicolon delimited list of email addresses on the client side. The regex below works on the server side but doesn't work with the javascript because javascript regular expressions don't support conditionals. "^([A-Za-z0-9_\+\-]+(\.[A-Za-z0-9_\+\-]+)@[A-Za-z0-9-]+(\.[A-Za-...

Working with links asp.net mvc2

How do I make a static link in a view? (using ASP.NET MVC2) I am working on the site navigation, and have basically 4 main areas. These are split into sub areas, and one controller looks after the entire "main area". So basically after clicking on a main area, i'd like to display a list of links to the different sub areas. I created th...

NHibernate query is not returning any results

I'm trying to get Fluent and NHibernate configured properly with ASP.NET MVC. As far as I know it's configured properly but when I access the page that uses this setup I am not receiving any data results. The model I'm using is called Brand and the database table is Brands. Here is a snippet from my BrandController: public ActionResul...

.NET MVC2 custom subpage routes

In searching I came across http://stackoverflow.com/questions/411054/asp-net-mvc-page-subpage-routing and the wildcard was somewhat of a lifesaver, but presented a new problem. Consider the following routes, if you will. The goal here is to have the index (http://www.domain.com) use the default route and [domain]/page use the Content ro...

Injecting AutoMapper dependencies using Ninject

I am having trouble injecting AutoMapper into an ASP.NET MVC 2 application using Ninject. I used Jimmy Bogard's post on AutoMapper and StructureMap type Configuration as a guide. public class AutoMapperModule : NinjectModule { public override void Load() { Bind<ITypeMapFactory>().To<TypeMapFactory>(); Bind<Config...

MVC 2 Validation Attribute Unit Testing Using IoC

I am currently writing some unit tests for an ASP.NET MVC 2 controller and having some issues with the MVC 2.0 validation attributes. The validation attribute in question uses a repository to check that no duplicate names exist in the current data source, and I would like to replace this repository with a fake one during my unit test. I ...

Error "HRESULT E_FAIL has been returned from a call to a COM component" when adding a reference to a .Net 4 project in Visual Studio 2010

Hi, I get an Error "HRESULT E_FAIL has been returned from a call to a COM component" when adding a .dll reference to a project in Visual Studio 2010. The weird thing is, if I make a local copy of the .dll, and reference it locally it's fine. However, if I try and reference it from our shared resources server (\server\release\Common\Pa...

LabelFor htmlhelper MVC2: How can a propertyName by empty

I want to use a MVC HtmlHelper similar to LabelFor. When using reflector on the code for this helper, I found the following code: public static MvcHtmlString LabelFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression) { return LabelHelper(html, ModelMetadata.FromLambdaExpression<TModel...

Cannot Create a Asp.net MVC 2 project in Visual Studio 2010 RTM

Trying to learn MVC and I have VS 2010 RTM installed but I cannot find a MVC choice in the new project dialogs (looked under C#/web and I am doing new -> Project -> Visual C# - > Web) am I missing something? ...

State management in MVC 2

Hi All I want to show a Session Variable data on View. How can i achieve it. I am storing some data in Session varaibles and noew i want to display it on View please help me. I am new Asp.Net MVC 2 Please suggest. ...

asp.net mvc 2 client side validation missing ValidationRules on custom attribute

Hi all, Can't seem to get checkbox to be validate on client-side using asp.net mvc 2. Here is my code. Model [Serializable] public class RegistrationModel { bool termsAndCondition = false; [RequiredToBeTrue(ErrorMessage = "Need terms and service")] public bool TermsAndConditions { get { re...