asp.net-mvc

Why is my selected value showing up twice in a dropdownlist (asp.net mvc)

i have an asp.net mvc view with the following code to show a dropdown list: <% = Html.DropDownList("filter", Model.MyList, Model.MyDefaultValue, new { @id = "filter", @class = "complete" })%> Model.MyList is a List with my items and one blank one at top and Model.MYDefaultValue is a string. When i run this it looks like it works but...

ASP.NET MVC2 instant 404 Errors

Hi I have a ASP.net MVC2 website that was working great when using Visual Studio 2010 RC But after installing Visual Studio 2010 Ultimate, i have been seeing nothing but 404 errors from my mvc website. I'm pretty sure it actually is a MVC2 app, but after reading around i'm getting confused. But how that could result in the 404 errors i...

ASP.NET MVC - Create RSS feed that requires authentication

Hello, I've created a rudimentary RSSActionResult in ASP.NET MVC to generate an RSS feed based on new items in my ecommerce store - new items, sale items etc. That part was easy and works well. I would like to go one step further and create a feed that is user specific. For instance - show users new products of interest based on their p...

WebMatrix, ASP.NET Razor, IIS Developer Express, SQL Server Compact Edition - What is Microsoft objective behind these new technologies ?

Recently Microsoft (via Scottgu) has announced some new technologies (WebMatrix, ASP.NET Razor, IIS Developer Express, SQL Server Compact Edition). I think this is something new direction in which Microsoft is trying to move since launching of ASP.NET MVC. I think the clear target of these new moves are Ruby/Python/PHP/.. developers or c...

nhibernate.validator vs DataAnnotations

In my APS.NET MVC project Im using DataAnnotations for validations. I moved from L2S to NHibernate orm and in fact found that NHibernate has own validator (NHibernate.Validator) Is it make sense to move to NHibernate.Validator as well? for example DataAnnotations has [Required] attribute and NHibernate.Validator [NotEmpty, NotNull, No...

ASP.NET MCV 2 Without Data Model Query

Can anyone tell me how to use ASP.NET MVC 2 without data models...i mean i have sql database and stored procedure which has employyes table i wanna show all employees list on a View without using any data model. ...

Mocking and Stubbing Ajax Requests

Dear All, Yesterday I re-factored the below method to return either a full view or a partial view. public ActionResult List(int page) { var viewModel = GetListViewModel(page); if(Request.IsAjaxRequest()) { return PartialView("_list", viewModel); } return View("PartsList", viewModel); } But now my tests h...

Nice URLs based on multiple parameters

Hi all, it is quite clear what the advantages of using nice urls in you web site are. Let me clarify what i am asking by using an example. To note that the entities here cannot be uniquelly identified by name. Say the user wants to see all the radio stations registered at your site that are available at a specific location. This is do...

How to retrieve data from the DB for recursively binding a jquery treeview using asp.net mvc

I have a table structure like this. id | Name | ParentId so for example: id | Name | ParentId 1 | Alice | 0 2 | Bob | 0 3 | Charlie | 1 4 | David | 2 where 'Alice' and 'Bob' are Parent nodes( which has Id = 0) and Alice has a child node named 'Charlie' and 'Bob' has a child node named 'David'. My question is...

how do I use mvc data annotations in conjunction with auto generated linqtosql classes

I would like to be able to use DataAnnotations when working with my model, so for instance be able to write stuff like [DisplayName("Title")] [StringLength(256)] public string title { get; set; } I also want to be able to use the column with linq which has led me so far to adding table and column linq mapping annotations such as [C...

using jquery datatable for server side processing with paging, filtering and search

I need to use the jquery datatable server-side processing (http://datatables.net) for my asp.net mvc (C#) application. My application has thousands of records to show in the table as list. I am using jquery datatable to enable paging, filtering and search. Is there any good reference/articles for jquery datatable server-side processin...

Challenges with selecting values in ListBoxFor

This is my first question, and it is probably a poor one, so please be gentle. Working on my first ASP.Net MVC2 web app recently, I came across some issues when I needed to select multiple values in a list box. I worked around it with some jQuery, but went ahead and put together some very simple code to demonstrate. I'm using EF for t...

asp.net mvc : can i write AuthorizeAttribute in model

hi all, in asp.net MVC architecture, can i write AuthorizeAttribute on the method of model class? i am trying to do this but its not working. please let me know how can i do this..? ...

Is html.renderaction code smell

I've recently started a new job where I've been thrown into a bug fixing role on an under development ASP.Net MVC application. I'm a big fan of using an MVC approach for web apps and built some hefty production apps on Maverick.Net starting back in 2004/2005 however this is my first time using the ASP.Net MVC framework for anything other...

ELMAH is not logging

I've been using ELMAH on my development machine and it works fine. I also deployed it on Win2008 IIS7 and run the LOCALHOST website with force exception and it logs.. However, when i try browsing the website on other machine (using other machine from the network to browse the website) ELMAH is not logging.. I've check the App_Data for xm...

asp.net mvc rhino mocks mocking httprequest values

Hi Is there a way to mock request params, what is the best approach when testing to create fake request values in order to run a test would some thing like this work? _context = MockRepository.GenerateStub<HttpContext>(); request = MockRepository.GenerateStub<HttpRequest>(); var collection = new NameValueColle...

InputBuilder's PartialView("My") doesn't work

my viewmodel public class CaseCreateInput { [PartialView("My")] public object AreaId { get; set; } } My.aspx partialview <%@ Page Title="" Language="C#" MasterPageFile="Field.Master" Inherits="System.Web.Mvc.ViewPage<PropertyViewModel<object>>" %> <%@ Import Namespace="MvcContrib.UI.InputBuilder.Views"%> <asp:C...

Catch error in file upload in MVC

Hi In my MVC web app, I have a file upload page. A file size restriction is set to 60MB in web.config. So, anything upto 60 MB is fine. But, if I upload larger files, my application crashes. The form post is not reaching at the action method. How can I handle this elegantly? Any ideas? Cheers Daniel ...

RouteValueDictionary in querystring with t4mvc?

Hi, Whenever I use t4Mvc to create a form post Url, e.g. <% using (Html.BeginForm(MVC.Admin.Login.Index())) { %> It generates a route like the following: <form method="post" action="/admin/login/index?RouteValueDictionary=System.Web.Routing.RouteValueDictionary"> or when i use <% using (Html.BeginForm(MVC.Admin.Login.Index(nul...

are there any good open source WIKIs based on asp.net mvc?

I am looking for a good WIKI software to host on Windows. Are there any based on ASP.NET MVC that have been built? I can't seem to find any by googling. ...