asp.net-mvc

Controller ambigous error, upgraded to MVC 2

I upgraded to MVC 2, updated all my assemblies (did copy to local also). I changed my routes to this: routes.MapRoute( "Admin", "admin/{controller}/{action}/{id}", new { controller = "Admin", action = "index", id = ""}, new[] { "MyNamespace.Web.Controllers.Admin" } // name...

ASP.NET MVC: Server Validation & Keeping URL paramters when returning the view

I currently have the following code for the POST to edit a customer note. [AcceptVerbs(HttpVerbs.Post)] public ActionResult EditNote(Note note) { if (ValidateNote(note)) { _customerRepository.Save(note); return RedirectToAction("Notes", "Customers", new { id = note.CustomerID.ToString() }...

Call to Render Partial not working after MVC 2

I was calling render partial like this in MVC 1.0: <% Html.RenderPartial("~/views/shared/categories.ascx", ViewData.Model.Categories); %> Now after dropping MVC 2.0 .dll's, I am getting the error: CS1061: 'object' does not contain a definition for 'Categories' and no extension method 'Categories' accepting a first argument of type '...

LINQ to Entites: how can I implement this complex t-sql in LINQ (multiple joins, DISTINCT, NOT EXISTS) ?

I have a complex query that I'm trying to reproduce in LINQ to Entities, but I'm not there yet - is it possible? The t-sql query looks like: select distinct C.id, L.id from dp join L on L.fk = DP.id join M on ( M.l_code = L.l_code and M.dp_code = DP.dp_code ) join C on C.c_code = M.c_code where not exists ( select id from map whe...

Why does my route get redirected, this doesn't make any sense to me

I have these 2 routes mapped out: routes.MapRoute( "Admin", "admin/{controller}/{action}/{id}", new { controller = "Admin", action = "index", id = "" } ); and then I have: routes.MapRoute( "Default", ...

Reasons for not using JQuery to Log in user?

Im using asp.net mvc and form to log in user. I am wondering if there is any issue with using jquery to log in user instead and what I should be concerned about in terms of security as well. thanks EDIT: I ONLY MEAN PASSING THE USERNAME AND PASSWORD TO THE MVC CONTROLLER. THE SITE USES A LOT OF JAVASCRIPT. ...

jQuery (or maybe the browser) is cache-breaking ajax loaded scripts

I'm loading a view page via an $.ajax() call with jQuery. I'm explicitly setting the "cache" option to true. Nowhere in the application are we using $.ajaxSetup() to specify otherwise. Here's the ajax request setup: $(".viewDialogLink").click(function() { $.ajax({ url: $(this).attr("href"), dataType: "html", ...

Django or RoR like common Java or ASP web-frameworks

Hello, I am a fan of big agile software development methodology and love to develop web pages using Django and RoR. However, it creates a big constrain as there are really very few Django or RoR developers to hire. For a new web project, we will be hiring developers and even though I would love to see these employees using such tools, ...

If a key does not exist in the ModelState, how can I add it? aspnetmvc1

Hello! I am trying to create a workaround in my controller which handles a bug in ASP.NET MVC v1. The bug occurs if you post a listbox which has nothing selected (http://forums.asp.net/p/1384796/2940954.aspx). Quick Explanation: I have a report that accepts two dates from textboxes and one or more selections from a ListBox. Everythin...

Elmah logs error even if there isnt?

Elmah is logging the following even though there is no sign of a problem. if i remove elmah i dont get the exception, what could be wrong? System.ArgumentException : The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Thread(Int32, System.String)...

Why is my asp.net mvc publish not working anymore?

I'm running asp.net mvc and have been since last April. All along I have been publishing my site using the Publish feature in Visual Studio. This week, I added some telerik scripts and the jquery 1.4 script. For some reason, when I try to publish, it's failing on the jquery script. All the telerik scripts loaded fine and they are in ...

Handle security denied in ASP.NET MVC with AspNetSqlRoleProvider

I'm looking to secure different areas of my MVC application to prevent standard user's from accessing admin type views. Currently, if any user is logged in and they attempt to view the About page (out of the box template in visual studio), it will simply redirect them to the login page. I'd prefer the user is informed that they do not ...

Deploying ASP.net MVC Applications to Staging and Production with SQL

We have been a ColdFusion shop for 10 years, and are now switching over to ASP.net MVC. Our target framework is .net 4.0 BETA 2 using VS 2010 BETA 2. We set up two instances of Windows Server 2008 (staging and production), and will be using our existing database server (SQL Server 2008). None of us really have much experience in ASP.net...

PersonViewModel inherits from Person - clever or code smell?

In my ASP.NET app, I have a Person and a PersonViewModel. My Person was generated by LinqToSql. It has the properties that will be persisted in the database. My PersonViewModel has everything Person has, plus a couple "select lists", which will be used to populate combo boxes, as well as a FormattedPhoneNumber (which is basically a Pho...

Caputure Signatures in asp.net mvc

I am going to start to work with electronic signatures for a website for my company. I was wondering if anyone had any suggestions on best practices and/or implementations. Note, I am not asking for anyone to spoon feed me code. I want to get ideas on how to go about it. I would like to be able to use a usb signature pad and submit the s...

Can you use MVC 2 Strongly Typed Helpers in Partial View?

I'm trying to use the new strongly typed helpers. I've inherited the Model in my Control: Inherits="System.Web.Mvc.ViewUserControl" but intellisense isn't exposing the model and the page isn't happy with it if I force the code in. If I do it in a standard View all is good. This is what I'm expecting to be able to do: <%= Html.LabelFor...

jQuery Form, ASP.NET MVC JSon Result

I'm trying to return a json result from a jQuery Form instance - but it keeps prompting me to download a file instead of displaying it in the window like it is supposed to... $("#ajaxImageForm").ajaxForm({ iframe: true, type: "GET", dataType: "json", beforeSubmit: function() { $("#ajaxImag...

Adding Custom attributes to the page directive in asp.net-mvc

I have created a base class that derives from ViewPage with a custom public attribute that I want to be able to set in the @page directive however I am getting the following error. Error 24 Error parsing attribute 'attrame': Type 'System.Web.Mvc.ViewPage' does not have a public property named 'attrname'. the directive looks as so <%@...

ASP.Net MVC - return view and launch document at same time

I have a ASP.Net MVC form that upon submit I need a couple of things to happen. Firstly I need to generate a pdf report and launch it Secondly I need to return to the main index page Currently I can do the first by returning a filestream from my action OR the second by returning a view but I can't figure out how to do both Can anyon...

based on Session(UserType), display particular div on ASP.NET MVC Page

Hi I have a view page that has two DIV tags. If the session[UserType] = ‘Guest’ , then I need to diplay Guest DIV Section. Else If session[userType] = ‘Logged’ , then I don’t need to diplay Guest DIV Section. <div id="Logged" > <div class="txtContent"> <label for="product" class="Form_Label">product:<em>*</em></label> ...