asp.net-mvc

Implementing a search page using url parameters in ASP.NET and ASP.NET MVC

Let's say I have a search page called Search.aspx that takes a search string as a url parameter ala Google (e.g. Search.aspx?q=This+is+my+search+string). Currently, I have an asp:TextBox and an asp:Button on my page. I'm handling the button's OnClick event and redirecting in the codebehind file to Search.aspx?q= What about with ASP.NE...

Master Page Error on New MVC Project

I've just create a new MVC project, and have made no changes at all, but when I try and view the ChangePasswordSuccess view in design mode, I get the error: The page has controls that require a Master Page reference, but none is supplied. The page has no controls except for a content control and literal text, and it does have a master...

Why ASP.NET MVC bothers to have a Default.aspx file?

When create a new ASP.NET MVC project in Visual Studio 2008, there is a Default.aspx page by default. It has one line <%-- Please do not delete this file. It is used to ensure that ASP.NET MVC is activated by IIS when a user makes a "/" request to the server. --%> In its Page_Load function, it just redirects to "/" to go thro...

Passing web context to a 'service' in ASP MVC app

Hi I'm trying to work out a way of passing the web current http context to a service class (or initialising the class with a reference to it). I am doing this to abstract the rest of the app away from needing to know anything about the http context. I also want the service to be testable using TDD, probably using one of the Mockable f...

Unable to cast object of type WhereListIterator<system.web.Mvc.ListItem> to type system.web.mvc.listitem

I have a SelectList that I first check for a selected value != null and then want to use this selectedvalue in a where clause for a filter. Like so: if(searchBag.Qualities.SelectedValue != null){ ListItem selected = (ListItem)searchBag.Qualities.SelectedValue; } I made the cast in a seperate useless line to pinpoint the problem. T...

Where to get Microsoft.Web.Mvc.dll

Where do you get Microsoft.Web.Mvc.dll? I see it included in a lot of ASP.NET MVC open-source projects but it's not on my system after having installed ASP.NET MVC Beta and .NET 3.5 SP1. In the ASP.NET MVC Beta source code from codeplex.com the Microsoft.Web.Mvc.dll is produced by the MvcFutures project. Is everyone compiling this modul...

Using the jQuery validatation plugin to send multiple values to an ASP.NET MVC controller action?

Hi, Using the jQuery Validation plugin and AJAX, how can I validate the contents of say an input (textbox) but pass more than one parameter to a controller action? A brilliant example of passing a single value via AJAX using the plugin can be found here. ...

How do I continue working on the server after returning a response with ASP.NET? (WebForms and MVC)

Hi.I have an application where I need the user to upload a photo. After the photo is uploaded to the server, which shouldn't take very long, the user should get back a response that's a regular HTML page saying "thanks...bla bla bla..." Now, after the the response is sent back to the client and he goes on his merry way, I want the server...

Is .NET MVC must learn technology?

Is it here to stay, or is this something just pushed out quickly as a "me too" offering, in response to the Rails community? Is it necessary to go through the learning curve, and will the Framework move to only working this way, without the Page behind model? If so where's the best place to pick up MVC essentials for .NET? ...

MVC Examples use of var

Maybe I live in a bubble, or am just too new, but I was wondering if anyone else has noticed the heavy use of 'var' to declare variables instead of a specific type in many of the MVC examples by Microsoft? Is there a purpose for this, or is it the "in" thing to do now, or just personal style? Curiously, Jeff ...

MVC Beta [HandleError] Attribute (need help)

I've tried this both with and without the 'ExceptionType' parameter. I have an Error.aspx page in both the Views/Shared folder and the Views/thisController folder. But everytime I run this I get a "Server Error in '/' Application." error page, rather than the nice one in Views/Shared. Any idea what could be going wrong here? [HandleErr...

Using a Base Controller for obtaining Common ViewData

I am working on an ASP.NET MVC application that contains a header and menu on each page. The menu and header are dynamic. In other words, the menu items and header information are determined at runtime. My initial thought is to build a base Controller from which all other controllers derive. In the base controller, I will obtain the ...

Can I precompile my ASP.NET MVC application?

Hello. I tried to precompile my ASP.NET MVC application and deploy it to an IIS6 box (with wildcard mapping), however I am getting an error with rendering partial views (user controls). Its working fine on my dev machine before precompiling. The error is: Server Error in '/' Application. The partial view 'ListGrid' could not ...

"the project type is not supported by this installation" error

I have installed VS 2008 SP1 on W2k3 OS. After I installed ASP.NET MVC beta and tried creating ASP.NET MVC type project I get the following error. "the project type is not supported by this installation" Let me know if you have fixed this issue. ...

ASP.NET MVC changed a lot after ScottGu's blogging?

I'm reading ScottGu's blog about ASP.NET MVC, and found a lot of code cannot compile or doesn't work as expected. http://weblogs.asp.net/scottgu/archive/2007/11/13/asp-net-mvc-framework-part-1.aspx http://weblogs.asp.net/scottgu/archive/2007/12/03/asp-net-mvc-framework-part-2-url-routing.aspx So, did ASP.NET MVC go through huge change...

Why doesn't setting the selectedValue in the Selectlist make that value highlighted in the browser?

When I do this: new SelectList(items, dataValueField, dataTextField, items.First()); I get a SelectList with that item selected (it is inserted as SelectedValue), but not highlighted. What should I do to get a dropdown with a list where I decide in advance what item is selected when the page loads? ...

Somebody explain me Html.DropDown and it's dearest friend SelectList

If you check my earlier questions you may have noticed I just don't get the SelectList and Html.DropDown(). I find it intrigueing that I seem to be the only one in this. So maybe I should try to change my mindset or maybe there are things I don't know that will clear this all up. I really love the whole MVC framework, but SelectList just...

Request.Write - execute in Head tag. [Action - Templates]

I use BaseUserControl, where I have a method private string typeName { get { return GetType().FullName; } } private object headOne { get { return Context.Items[typeName + "_Head"]; } set { Context.Items[typeName + "_Head"] = value; } } public void Head(Action template) { if (headOne == null) { template(); ...

Is it possible to integrate AJAX toolkit into MVC applications?

How do I integrate AJAX toolkit into MVC applications in .net? ...

One site, multiple clients ui

I have an Asp.net Mvc site where I want to give a separate access and user interface to different clients like: http://company1.mysite.com http://company2.mysite.com http://company3.mysite.com Each client will have a different ui but practically same functionality (or with some features disabled). I'd like to separate graphics for ea...