asp.net-mvc

ASP.NET MVC GoogleBot Issues

I wrote a site using ASP.NET MVC, and although it is not completely SEO optimized at this point I figured it is a good start. What I'm finding is that when I use Google's Webmaster Tools to fetch my site (to see what a GoogleBot sees) it sees this. HTTP/1.1 200 OK Cache-Control: public, max-age=1148 Content-Type: application/xhtml+xml; ...

Url.Action only render controller and action but not id

I need to render a URL for a JavaScript search that I am doing. Unfortunately Url.Action renders not only the action but the current id. This occurs when presently on page utilizing the action with the id. To illustrate Url.Action("List", "Org"); will first render Org/List from which I can append an org to be listed. However, after the ...

Multiselect list not showing selected items in c# mvc using linq2sql

I've tried many different ways to pass the selected items to the multiselect list with no luck. Finally, I tried this, which I think should display all the items as selected and still nothing in the list is selected. public MultiSelectList Companies { get; private set; } Companies = MulitSelectList(subcontractRepository.SubcontractCom...

ASP.Net MVC RC 2.0 Upgrade From MVC 2.0 Beta Validation Issue

We just recently upgraded our application and noticed that we're getting runtime errors on all of our Html.ValidationMessages and Html.ValidationMessageFor. There error is: The given key was not present in the dictionary. We've been passing the modelName/expression and it was working fine until the upgrade. I also checked out the bre...

MVC 2 RenderAction

Im having a value in ViewData, lets say htmlhelper.ViewData["myData"]="some"; And in partial page I can overwrite the myData's value. But when I using the Html.RenderAction() and call a partial page. In the same partial page htmlhelper.ViewData["myData"] is null. ...

routing legacy asp.net links in an asp.net mvc project

I have the following url I need to support in my asp.net mvc project for a while. http://www.example.com/d.aspx?did=1234 I need to map this to this url. http://www.example.com/Dispute/Detail/1234 I have already looked at the following information. http://blog.eworldui.net/post/2008/04/ASPNET-MVC---Legacy-Url-Routing.aspx http://s...

MVC Custom Routes and ActionLinks

We are working with an asp.net mvc app that is shared by multiple clients. We need the urls to include the clients url friendly name. For example: domain.com/clientName/controller/action/id This below appears to be working when it comes to routing, but the "clientName" is not generated correctly for the action link helpers. _routes....

Conditionally disable Html.DropDownList

How can I change this DropDownList declaration so that the disabled attribute is enable/disabled conditionally? <%= Html.DropDownList("Quantity", new SelectList(...), new{@disabled="disabled"} %> non-working example: <%= Html.DropDownList("Quantity", new SelectList(...), new{@disabled=Model.CanEdit?"false":"disabled"} %> p.s. addin...

how-to enable Client-Side validation fora textbox

how-to enable Client-Side validation for a ordinary textbox in ASP.NET MVC. ...

Validating a SelectList in ASP.NET MVC 2 with Data Annotations

I'm trying to use the built in ASP.NET MVC 2 client side validation on a Select List like the following: private SelectList _CategoryList; [Required(ErrorMessage = "Category Required")] [System.ComponentModel.DataAnnotations.Range(1, double.MaxValue, ErrorMessage = "Please Select A Category")] [DisplayName("Cate...

What is a good simple wysiwyg text editor to use with asp.net mvc?

Hi, What is a good and simple wysiwyg text editor to use with asp.net mvc I only need the bold and insert a link functionalities. Thanks :) ...

"At least one SSDL artifact is required for creating StoreItemCollection" Error with Entity Framework

I have recently been getting this error on my ASP.NET MVC project that uses the Entity Framework: At least one SSDL artifact is required for creating StoreItemCollection The error occurs when I try to query the database in a controller action. Has anyone seen this error before? It only occurs every once in a while for me but I am...

Could not load type 'System.Web.Mvc.AreaRegistration' from assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

[TypeLoadException: Could not load type 'System.Web.Mvc.AreaRegistration' from assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.] HemelMvc.MvcApplication.Application_Start() in D:\@Hemel\HemelMvc\src\HemelMvc\Global.asax.cs:72 [HttpException (0x80004005): Could not load type 'System.Web.Mvc...

LINQ InvalidCastException error

Hi, I'm getting "InvalidCastException" (occurred in System.Data.Linq.dll) in my function: public User GetUserByKey(Guid key) { return usersTable.FirstOrDefault(m => m.UserKey == key); } which is called here: MembershipUser mu = Membership.CreateUser(user.UserName, user.Password, user.Email, null, null, true, Guid.NewGuid...

IIS7 Url Rewrite - Redirect from {any}.aspx to {any}

I am converting my website from Asp.Net Webforms to Asp.Net MVC. I want to redirect all my old .aspx files to drop the .aspx. I run IIS7 with the Url Rewrite module installed. Example: /about.aspx -> /about The user will go to http://www.site.com/about.aspx and I want them redirected to http://www.site.com/about. How do I do this u...

How can we filter the records in a strongly typed partial view in ASP.NET MVC?

Hi I have a strongly typed partial view that populates all the Records from Search table. Now i have a textbox to enter name & a button to filter the records that can match a name.(Like Search page). Can anybody provide code sample for this scenario? My Main Page loads particular view based on the radiobutton selection(Search or Inqu...

Best calendar control available in .net to implement drag and drop from treeview onto calendar

I want in my asp.net application is to create a schedule.The events should be dragged from the treeview and dropped onto the calendar control to create the schedule.What i want is that someone could suggest what is the best calendar control available in the market to do so.My budget is 300$.If there is some other way of achieving this th...

The Model-Repository-Service-Validator-View-ViewModel-Controller design pattern (?)

When I first heard about ASP.NET MVC, I was thinking that would mean applications with three parts: model, view, and controller. Then I read NerdDinner and learned the ways of repositories and view-models. Next, I read this tutorial and soon became sold on the virtues of a service layer. Finally, I read the Fluent Validation documentati...

asp.net mvc: how to mock Url.Content("~") ?

anybody knows how to mock Url.Content("~") ? (I'm using Moq) ...

Custom authentication with service layer?

Hello I have an app with 3 "layers", first "datalayer", 2nd "businesslayer" and 3rd is the asp.net mvc site. And I'm trying to add forms authentication in the proper way. Should I somehow configure it to use the business layer? That gets/adds/updates user that is a part of the authentication to be? And in which project shall I add th...