asp.net-mvc

ASP.NET MVC localization: Get a resource instance

I'm trying to implement this feature. I created a resource and set it access modifier to public, also Custom Tool property value to PublicResXFileCodeGenerator. I'm trying to get an instance of this resource but I can't, either with strongly type the resource name nor with Type.GetType("WebProject.Resources.Home.ViewModels.ResourceNam...

ASP .NET MVC 2.0 or WebFoms to develope a Auction site like Ebay?

Hello ... I´d like to know what is the best option to develope a Auction site like Ebay with ASP .NET 4.0: MVC 2.0 WebForms I only worked with WebForms, but I have time to learn MVC if is the best option... What you think? Thanks ...

Putting CAPTCHAs on their own page?

We need to put a captcha image on our ASP.NET MVC 2 based website. We chose reCaptcha and built it in using the way described by Derik Whittaker. The idea there is baiscally to build some abstractions and all you need to do is decorate your Controller with a [ValidateCaptcha] attribute. This works all fine. However, we have a lot of for...

How do I make Html.ValidationMessageFor work on two properties?

Currently I have a custom attribute that targetted to a class like so: [PropertiesMustMatch("Password", "PasswordConfirm", ErrorMessage = "Passwords must match!")] The problem is that in only shows up on the validation summary, and does not highlight the incorrect textboxes. Is there a way to do that? ...

ASP.NET MVC 3 - What features do you want to see?

I know a bunch of people that are really enjoying the improvements that ASP.NET MVC 2 made over the first release. I have just started to migrate our MVC 1 project over and so far areas has totally cleaned up the subfolder mess we had in our large scale application. As I dive deeper into all the improvements and changes that were made ...

Using ASP.NET MVC, Linq To SQL, and StructureMap causing DataContext to cache data

I'll start by telling my project setup: ASP.NET MVC 1.0 StructureMap 2.6.1 VB I've created a bootstrapper class shown here: Imports StructureMap Imports DCS.Data Imports DCS.Services Public Class BootStrapper Public Shared Sub ConfigureStructureMap() ObjectFactory.Initialize(AddressOf StructureMapRegistry) End Su...

ASP.NET MVC jQuery: Shoud we be concerned about a lot of jQuery/javascript on a View?

We are moving from WebForms to MVC and and using a lot of jQuery. I appears we have a lot of jQuery/JavaScript in our Views, is this common and are there any concerns about security. The obvious step is to refactor into plugins and more generic UserControls etc, but this jQuery would still be "visible" by looking at js files etc. We ar...

Graduating from ASP.Net Webforms anti-patterns

On my current project, I'm stuck in an ASP.Net 2.0 Webforms anti-pattern quagmire. I am aware of the myriad of anti-patterns we're using (huge code-behinds, no separation of concerns, untestable code, and on and on). Now, I'm not interested in rescuing this application from this situation as it's too far gone. Instead, my focus is on ...

ModelBindingContext ModelName

Can anyone explain where the ModelName gets populated from? Looked in MSDN documentation and no explaination here. I am creating a custom model binder and within it I get null for the following: var result = bindingContext.ModelName); ...

Need Help Creating a Route in ASP.NET MVC

I want to create a route like //Widgets/PerformanceTable/['best' or 'worst' to sort by performance of an investment] where either 'best' or 'worst' are required. Can somebody show me a good way to do this? Thanks ...

Disable validation on certain fields

I've got a ViewModel for adding a user with properties: Email, Password, ConfirmPassword with Required attribute on all properties. When editing a user I want the Password and ConfirmPassword properties not to be required. Is there a way to disable validation for certain properties in different controller actions, or is it just best to ...

jQuery/Asp.Net mvc username lookup

OK, for the life of me I can't uderstand why the follwing code is always returning false?? I have debugged with firefox to see what going on, but the function seems to always return false even when the condition username taken is 0(false), here is the jquery code: function CheckAvailability() { showLoader(); $.post("/Account/Che...

Some questions about slugs in ASP.NET MVC content system

In my application I'm currently using forms which allow to enter Title and Slug fields. Now I've been struggling with the slugs thing for a while because I can never decide once and for all how to handle them. 1) Make Title and Slug indenpendent Should I allow users to enter both Title and Slug separetely? This is what I had first. I a...

How to fix a NHibernate lazy loading error "no session or session was closed"?

I'm developing a website with ASP.NET MVC, NHibernate and Fluent Hibernate and getting the error "no session or session was closed" when I try to access a child object. These are my domain classes: public class ImageGallery { public virtual int Id { get; set; } public virtual string Title { get; set; } public virtual IList<...

Silverlight Cannot find XML data source

Hello.. I am very new to Silverlight development. I understand that this is client side technology therefore the paradyme is differant from that of conventional ASP.NET development. Having said that, I don't understand where my server side code is deployed. I have a silver light \ MVC application. I am trying to read an XML document fr...

How to use HTML-5 data-* attributes in ASP.NET MVC

I am trying to use HTML5 data- attributes in my ASP.NET MVC 1 project. (I am a C# and ASP.NET MVC newbie.) <%= Html.ActionLink("« Previous", "Search", new { keyword = Model.Keyword, page = Model.currPage - 1}, new { @class = "prev", data-details = "Some Details" })%> The "data-details" in the above htmlAttributes give the...

What is wrong with the following Fluent NHibernate Mapping ?

Hi, I have 3 tables (Many to Many relationship) Resource {ResourceId, Description} Role {RoleId, Description} Permission {ResourceId, RoleId} I am trying to map above tables in fluent-nHibernate. This is what I am trying to do. var aResource = session.Get<Resource>(1); // 2 Roles associated (Role 1 and 2) var aRole = session.Get<Ro...

How to set the selected index property for a SelectList with strings? (ASP.NET MVC)

I have the following code: // Form the continuities list string[] continuities = new string[] { "10s", "20s", "30s" }; Model.Continuities = new SelectList(continuities, 2 ); I expect "20s" to be selected How can I do that without creating a new class? ...

Example of an ASP.NET MVC post model?

I was watching the HaHaa presentation on ASP.NET MVC from MIX and they mentioned using a Post Model where I guess they were saying you could use a model that was ONLY for posting. I have tried looking for examples for this. Am I not understanding what they are saying? Does anyone have an example of how this might work in a strongly typed...

Are view models used in rails?

I'm starting to develop a small application in ruby on rails and many questions arise. I should say that I have about 1 year of experience with ASP.NET MVC and feel at home with models views and controllers. I've been using view models extensively (with the help of AutoMapper) and now wondering if view models are used similarly in rails ...