asp.net-mvc-2

Why did S#arp exclude AccountController?

I noticed AccountController and views aren't in S#arp Architecture project. And I've noticed there has been some trash talking of the code so I guess that's why S#arp doesn't include it. What's the recommended approach? I had planned to write this myself anyway but changed my mind after reading Scott Hanselman's book that included Nerd D...

ASP.NET MVC + MySql Membership Provider, user cannot login

Hello, I've been playing around with using MySql as the membership provider for asp.net mvc forms authentication. I've got things configured correctly as far as i can tell, and i can create users via both the register action and asp.net web config site. however, when i try to login with one of the users, it does not work. it returns an ...

ASP.NET MVC 2 - First submit button on site doesn't work - rest is fine!

Sorry for unclear title - I don't know how to describe that problem in one sentence. Code sample will make it clear. First UP button do nothing when clicked. Rest works like it should! Below my view: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Main.Master" Inherits="System.Web.Mvc.ViewPage<GeekClick.ViewMo...

ASP.NET MVC EditorFor custom javascript

The following statement: <%= Html.EditorFor(model => model.Material.Serial) %> Generates the following code; <div class="editor-field"> <input type="text" value="" name="Material.Serial" id="Material_Serial" class="input-validation-error"> <span id="Material_Serial_validationMessage" class="field-validation-error">Debe in...

Is it good and safe to use Json object to submit form data? I am using MVC 2 with JQuery Post

In my ASP.Net MVC 2 application I am using a Json object to submit form data. I would like to take expert advice whether it is a safe and good practice to do it or not and why? Please note, this question is not about how to do it but rather about best practice. Appreciate your valuable suggestions. ...

Static HTML page navigation into an ASP.NET.MVC application

Hi I'm sure there's a simple answer but I can't think of it. I'm working with a designer who is using Dreamweaver to produce a series of static HTML pages and style sheets. These pages navigate to each other using standard anchors. However, on a couple of pages there needs to be a navigation to a page under ASP.NET.MVC 2 (from here I...

Code First adding to collections? How to use Code First with repositories? Advice me please

EDIT: this happen only on larger scale projects with repositories. Is there anybody using EF4 with code first approach and using repositories? please advice me Hi. Im currently working with EF4 Code First Classes. In my test project I got two classes, Author and Book (author got books). What I'm trying to do is that I HAve a AddBook in ...

how to create reusable "widget" markup across modules in an ASP.NET MVC 2.0 site?

Scenario: platform: ASP.NET 4.0, MVC 2.0 (doesn't have to be MVC if it's not the right solution) Create various widgets that inherit the same core markup: <div class="widget"> <div class="hd-widget"> <!-- dynamically inject code here for each actual widget --> </div> <div class="bd-widget"> <!-- dynamical...

How can I get data from input fields that are on master page?

Hi, I'm using ASP.NET MVC 2 technology for developing my web site. I have two input fields in my master page (username and password) and one submit button. How can I get data from those input fields? Please help. ...

Entity edit form with Reference to another entity by drop down list

My issue involves updating an entity via an edit form with a reference to another entity represented by a drop down list. I'm using ASP.NET MVC 2. Details: Public Class Category { int Id { get; set;} string Name { get; set} Category Parent { get; set} } An edit page for the category generated by EditorFor Edit page contain...

What are the basic system requirement for installing asp.net mvc 2 application.

What are the basic system requirement for installing asp.net mvc 2 application. Edited:- If I want to host the asp.net mvc 2 application on the windows XP then is there any special requirement like IIS version, Framework, service packs or else ? ...

ASP.NET MVC User input in C#

Hello, I am having the following issue, when a user fills in a form, I make an xml file based on that information and copy a file from one folder to another. (The filename is input by the user). If the file already exists however, there will have to be a user input on whether to overwrite this file or not. I know I can't use a message...

ASP.NET MVC: Route with optional parameter, but if supplied, must match \d+

I'm trying to write a route with a nullable int in it. It should be possible to go to both /profile/ but also /profile/\d+. routes.MapRoute("ProfileDetails", "profile/{userId}", new {controller = "Profile", action = "Details", userId = UrlParameter.Optional}, new ...

Amending Web Config for Test Fixtures

I'm using CassiniDevLib to host an MVC app for integration testing. In order to do it I need to amend some config settings on the web server so they match the integration testing environment, first one being the connection string so it points to the test database. I know I can have two copies of the web.config file and rename them but ...

SQL Compact Edition 4.0 CTP1 needs Visual C++ 2008 Runtime Libraries SP1

SQL Compact Edition 4.0 CTP1 needs Visual C++ 2008 Runtime Libraries SP1 and if SQL CE is deployed privately in the application’s BIN folder the following have to be present on the machine for it to function properly: a. Installing the .NET Framework 3.5 SP1 also installs the Visual C++ 2008 Runtime Libraries SP1. b. Or insta...

How can I upload files only with type image in asp.net mvc2

Hi all, I want to upload Images only with file upload in asp.net mvc2 and show validation for the user in client side using jquery or mvc validation and server side also. any one can help? Thanks. ...

JQuery DataPicker not picking up default format in MVC2

I'm using MVC2 and have included the Jquery DateTime picker. For some reason it is not using the default format settings when the pages loads. The model is passing in a Date and I have set the format to 'dd/mm/yyyy' as I do not want the time to be displayed. The html.editorfor that the datepicker is attached to, shows in the standard 'm...

Has anyone got Datatables 1.7.x to actually work with ASP.NET MVC 2 ?

Hello, Is there a demo somewhere how to use Datatables 1.7.x with ASP.NET MVC 2 ? Is saw an early demo somewhere but the Datatables API has since been updated. Does anyone have working code for implementation ? Thanks! ...

MVC Validating Strongly Typed Views

I have following ViewModel: public IEnumerable<SelectListItem> SelectAdminsInGroup { get; set; } public IEnumerable<SelectListItem> SelectAdminsNotInGroup { get; set; } public model.Admin Admin { get; set; } Admin class: [PropertiesMustMatchAttribute("Password","ConfirmPassword")] public class Admin { public ...

Only allow access to action if redirected from specific action

Hi Is there a good way to restrict the access to an action, so you can only access it, if you were redirected from another action. For example: [HttpPost] public virtual ActionResult Create(MyViewModel vm) { if (ModelState.IsValid) { // do some work return RedirectToActio...