asp.net-mvc

How to assign multiple models to a single view?

I have a list of cities and a list of countries and both of them I want to have on the view (aspx) file. I'm trying something like this but it's not working: namespace World.Controllers { public class WorldController : Controller { public ActionResult Index() { List<Country> countryList = new List<Country>(); List<City> ci...

ASP.NET MVC ViewData Null

Hi, I am currently creating an e-commerce site using C# ASP.NET MVC and have just come across a problem. On pages such as product pages and search results pages, I have to pass Lists of data from my controller to the ViewPage and that works just fine. However, a null reference exception occurs if the Viewdata equals null. It happens ins...

How can i implement areas in asp.net MVC?

I want to separate the site administrator area from the main site and want neat urls for the admin side like admin/articles/list etc. How can i implement this feature in asp.net MVC elegantly? ...

Looking for a Yahoo Groups (CMS) replacement

I realise that this is an extremely open question, so let me narrow it down a bit. I am toying with the idea of creating a membership site that could replace an existing Yahoo group. I want to host the site, so that I control the data. Probably, an existing CMS could be a good starting point. The following features should be available: ...

Ajax in ASP.NET MVC Framework

I want a nice "on mouse over"-effect on a word. I want my system to show a 2*1 (inches) rectangle with some information in it. Please guide me to an url or show an example ...

Using Code Behind Model with MVC

I am trying to use ASP.NET Server Controls (ASP.TextBox etc) with MVC (to take advantage of the validation power, designer support etc). How can I shoehorn this into MVC architecture? For example, how can my button.click route to the controller or how can the data inside my server controllers be accessed via viewPage? Can point me to an...

ASP.NET MVC view - alternative frameworks

I know there exist alternative frameworks for creating views, different from the standard way of creating views in ASP.NET MVC. What alternative do you suggest and why? ...

ASP.NET MVC saving the state of the data on ajax link

Hello there, After reading and installing the application on the post at "Editing a variable-length list of items in ASP.NET MVC by Steve, I find it really useful. On the other hand, there was something missing on the "Add another item" ajax link because it does not save the state of the non-submitted records. When I click on the link a...

Applying Styles to ASP.Net MVC ViewData objects.

I have the following code in a MVC User Control (the field names have been changed to protect the innocent): <%=ViewData.Model.foo%> <%=ViewData.Model.Bar%> <%=ViewData.Model.Widget%> <%=ViewData.Model.Thingy%> <%=ViewData.Model.Address %> <%=ViewData.Model.AlternateAddress %> <%=ViewData.Model.CrossStreets %> <%=ViewData.Model.S...

Self-translation on a .Net MVC website to support localisation

Hi, We're a startup and we built a .net website which we are porting over to MVC. All our text was added to the site using labels so that resource files could be automatically built in the future using the tool in Visual Studio. I loved the idea which Facebook introduced encouraging the community to self-translate. I wonder if anyone...

JQuery Async postback issue, how do I fix this?

I have the following JQuery code which does similar functionality like Stackoverflow where the user clicks on the comment link and it displays the comments or in this case replies to a member's status update, generally it works great except when a member posts a new status update which updates the list of status updates using an ajax asy...

Passing arguments to views in ASP.NET MVC?

Hi, I've been experimenting with ASP.NET MVC and following this tutorial to create the basic task list application. I've gotten it running fine, everything is working although the video is in VB and I had some trouble getting it "converted" to C# but muddled through thanks to the codesample. Now, to further my knowledge I've decided to...

Ajax ModalPopupExtender with an edit form in ASP.NET MVC

hi Everyone, I have an events calendar and on each event in the calendar there is an edit link which open up ajax ModalPopupExtender for editing the event information. The issue that I am facing right now is that the edit has to be in a form so it can update the information on the server.. how do i deal with this??? And what would be...

MVC helper extension

why do i get the error " Expected class, interface, enum or struct" with string underlined? public static string IsSelected(this HtmlHelper helper, string A, string B) { return "wtf"; } ...

How to easily add lots of 'dumb' html pages to ASP.NET-MVC app

Lets say I'm converting a whole bunch of content pages - dumb HTML - over to MVC model. I'd want to stick all the plain HTML files in a directory and 'find' them based on a controller. This kind of appears to be what the 'HomeController' in the standard ASP.NET-MVC is doing, but I have to explicitly add each page. [HandleError] pu...

Is 'HomeController' in ASP.NET MVC template app a bad name for what it does?

I'm just getting into ASP.NET MVC and was a little confused in the sample app why 'HomeController' is called 'HomeController'. It seems to be a better name would be 'DefaultController' or 'ContentController'. Its really a little misleading because its name implies that its got something to do with controlling the homepage, but it reall...

Should I be calling each of my MVC views Index.aspx ?

If I'm not mistaken - the conventions of ASP.NET MVC seem to want me to do the following for a controller view. Thats to day I create 'Products' directory into which I place my 'Index' view. I then create a 'ProductsController' and create an 'Index' method on it which returns a View. Returning just View() with no arguments will go and f...

Is it possible to implement X-HTTP-Method-Override in ASP.NET MVC?

I'm implementing a prototype of a RESTful API using ASP.NET MVC and apart from the odd bug here and there I've achieve all the requirements I set out at the start, apart from callers being able to use the X-HTTP-Method-Override custom header to override the HTTP method. What I'd like is that the following request... GET /someresource/1...

Should an ASP.NET masterpage get its data from the view ?

I've been playing around with ASP.NET MVC with a site containing a Master Page. I created an MVC user control called ProductThumbnailControl. The user control displays a product and a small thumbnail image. The View is a ViewProduct view which displays full product information - the usercontrol just being a UI element off to the site. ...

How Can I Find The Path To A Folder from a Controller Constructor in ASP.NET MVC?

I am trying to get the path to a folder in my website root and save it to a class property when my controller constructor is called: public TestController:Controller{ string temp; public TestController(){ temp = ""; } } I have tried the following: temp = Server.MapPath("~/TheFolder/"); // Server is null ...