asp.net-mvc-2

Has anybody tried the new MVC HTML5 Toolkit from Codeplex?

I saw a tweet today referring to the MVCHTML5 helpers on Codeplex. I'm wondering if Anybody has tried this out yet? Does it add any real significant benefit over the default HTML helpers? What are the actual HTML5 aspects of this library? ...

how to return guid from a class in the controller

Is there a way I can return a Guid with the code below? For example, what I'm passing in to AddSchedule is a class. I want to return an Id from the class so I can so something with it in the controller. How would I change my code to resolve this? Controller ModelService.AddSchedule( new Schedule { ...

Upgrade MVC 2 to MVC 3 issues with views

I'm attempting to upgrade my existing ASP.net MVC 2 web application to MVC 3 so I can use the goodness that is the Razor Viewengine and other said improvements. After using the converter to convert my app from mvc2 to mvc3 I'm having issues with my strongly typed views. As an example here we have a view user control that is strongly ty...

Where can I learn how to deploy ASP.NET 4 MVC 2 applications to IIS7?

I've done a significant amount of searching and am having difficulty finding people who have encountered a similar problem. I have gone into the properties for my project and set it to use the local IIS web server instead of the VS Dev server. It created the virtual directory just fine. When I attempt to browse to the site, I receive th...

How to Loop the FormCollection using asp.net mvc

Hello friends, I need to Loop my FormCollection to get Id values from collection.. I have something like collection[0] collection[1] collection[2] collection[3] collection[4] collection[5] collectoin[6] I have 7 or more keys I need to get second Index that means 1 3 5 7 9 11. something likethat.. I need to loop to get those value...

<img> tag fails in MVC2 application

In an MVC2 view, I can't get tags to work at all. They show up as broken pictures. The tag (created by an Html.ImageFor() extension method that I wrote) is a perfectly valid tag, such as this, which I copied from the page source in IE: <img alt="Picture Display" src="~/Content/Pictures/IMGP0164 (resized).JPG" /> Note that if I don'...

Salting a password - are there better options than using a timestamp?

I'm currently building a couple of ASP.NET MVC 2 sites, and am wondering what my options are for salting a password. With my PHP work, I usually just obtained the timestamp of when a user registered, then appended it to the end of their password string before using SHA1 to hash the entire thing. My instinct is that this approach may no...

ASP.NET MVC2 - Detect javascript, store result in session variable

I want to render specific HTML in a partial view based on whether javascript is enabled or not. My idea was to some how detect whether javascript was enabled and store it in a session variable which I can then test for in my view e.g. <div class="product"> <% // if Javascript is enabled, load the images asynchrously, otherwise load ...

MVC HttpDelete Verb causing 405 Method Not Allowed

Hi All, I'm encounting a method now allowed exception when calling a controller action which accepts the Delete verb. I thought the problem was that the HandlerMappings in IIS 7.0 were wrong and when I looked at: ExtensionlessUrl-ISAPI-4.0_64bit ExtensionlessUrl-ISAPI-4.0_32bit ExtensionlessUrl-Integrated-4.0 Sure enough they didn'...

Json contentType: breaks Jquery POST to MVC controller

I'm was trying to fill in a description field when a drop-down was selected. I Got it working but I couldn't use a Json Content Type. This works <script type="text/javascript"> $(document).ready(function () { $("#ddl_id").change(function () { var test = $("#ddl_id").val(); $.ajax({ typ...

Best way to share a data model and controls between multiple ASP.NET MVC 2 projects

I am building a suite of applications, each its own MVC solution/project, between these applications I want to share the user auth / user util code (profiles, links to the different applications they can access). I am using the entity framework for data access. My question is what is the best way to share this code between the differen...

Please help! Html Helper extension methods

Hi I need some help creating this extenstion method. My View page enherits from <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/NoSideMenu.Master" Inherits="System.Web.Mvc.ViewPage<List<MyProject.Models.Customer>>" %> <% Html.Telerik().Grid(Model) .Name("customer-history-grid").Footer(false).C...

ASP.NET MVC 2 i18n

I found the following page on i18n and ASP.NET: http://wiki.asp.net/page.aspx/55/internationalization/ The videos were very helpful although they apply to ASP.NET WebForms more than ASP.NET MVC, e.g., the videos show you how to internationalize controls rather than text -- which leads me to another realization: there isn't (or I couldn'...

Web-service authentication from ASP.NET MVC 2 and FormsAuthentication

I'm using ASP.NET MVC2 which request methods from Web-service (My all DAO place in Web-service). For Web-service using Basic Authentication. For authentication from asp.net to web-service, I use FormsAuthentication. For this I was write WebServiceMembershipProvider inheritance from MembershipProvider. In method ValidateUser I connect to...

C#: Anonymous type as a parameter to ActionFilterAttribute

I would like to define following attribute on MVC2: public class BackAttribute : ActionFilterAttribute { public BackAttribute(object routeDict) { // Set local route property according to routeDict } } Attribute would be used like this with anonymous type: [Back(new { action = "Index", controller = "Home" })] public ViewResult D...

Displaying friendly, localized enum values using DataAnnotations in ASP.NET MVC2

What's the recommended way to display localized enum properties in MVC2? If I have a model like this: public class MyModel { public MyEnum MyEnumValue { get; set; } } and a line in the view like this: <%: Html.DisplayFor(model => model.MyEnumValue) %> I was hoping to just annotate the enum values with DisplayAttribute like thi...

JQuery CSS fails in IE 6, 8

here is code: <script type="text/javascript"> function doit(){ $('table td').each(function () { if ($(this).text().trim() != '') $(this).css("border", "1px groove white"); }); } doit(); </script> this works in chrome and firefox. BUT in IE 6 and 8 i have 'Object doesn't support th...

Asp.Net MVC 2 - Invalid Route

Once the app is deployed to the web server, I type in an invalid route the mvc app just hangs and then displays a blank page. On my local IIS, if I type an invalid route I get the exception: "System.Web.HttpException: The incoming request does not match any route.". I want the exception not the blank page. Any ideas? ...

Asp.Net MVC - Refresher Course

When MVC first came out, I was reading about it everyday and learning all I could about it. About the time MVC 2 RC2 came out, I stopped learning for various reasons (new house, new job, laziness). I now want to get back into MVC ... I have a half written blog that I want to finish, but I feel rusty when it comes to anything MVC. Can a...

Strongly typed user control model binding not working in Asp.Net MVC 2.0

I am using a strongly typed user control in one of the view. The coding is as follows: This is the call in my View: <table> <% for (int i = 0; i < ((List<string>)ViewData["MyProjects"]).Count; i++) { string viewIndex = "MyTasks" + i.ToString();%> <tr> <td> <%Html.RenderPartial("ProjectTas...