mvc

How can I use my local iis and mvc to work together?

I have started a new mvc project and clicked on project\properties\web - use local IIS server (mine is 5.1). I've created a virtual directory all ok. When I run I get a 403 error - in url http://localhost/myProjectName/ I have set IIS to windows integrated security and set web.config to windows. My ultimate goal is to use mixed win...

Should navigation logic be in the controller or the view?

In an MVC web app, where is the "right" place to put the code/logic to display a url link to a "next page" navigation control, the controller or the view? If I put it in the view, I have to pass to the view not only the data to be displayed on the current page but also data relating to the next page aka the page id of the next page. If...

CakePHP joining Models between two tables, twice

I have a question about how to set up the relations between two models when they join to each other in two different regards. I'll give an example of the problem I've got: Users (id, name) Messages (id, message, from_user_id, to_user_id) (In my case, it's not users nor messages, but this hopefully illustrates the problem in a simpler...

Include CSS file in view

In my view, I have included the Master page as follows: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Mall.Master" Inherits="System.Web.Mvc.ViewPage<DomainModel.Entities.Seller>" %> And in my Mall.master file, I add a link to include a general css file <link rel="Stylesheet" href="../../Content/MallMast...

Coupling between model and view in mvc pattern

Going through the mvc section at the chapter on compound pattern in the head first design pattern book, i came across the following thing that makes me uneasy. As per the description of mvc , model should have implementation of observer pattern and upon any change of its state it is supposed to notify all its observer of the event and as...

Should my MVC controllers be object-oriented?

I'm making a Perl website, and I'll using Template Toolkit (for the view), a whole bunch of objects for DB interaction and business logic (the model), but I'm wondering: should the controllers be OO? I feel like they should, just for consistency, but it also feels it might be a bit redundant when I'm not interacting with the controllers...

How to set one of the values in dropdownlist as selectedvalue in asp.net mvc?

I have a dropdownlist with values -1,1,2 and text A,B,C i wanna set B as selectedValue by default when the page is loaded. Something which can be done at the Page Level i.e in aspx or ascx. ...

Set Default DateTime Format c#

Is there a way of setting or overriding the default DateTime format for an entire application. I am writing an app in C# .Net MVC 1.0 and use alot of generics and reflection. Would be much simpler if I could override the default DateTime.ToString() format to be "dd-MMM-yyyy". I do not want this format to change when the site is run on...

System.Linq.Dynamic and DateTime

I am using System.Linq.Dynamic to do custom where clauses from an ajax call in .Net MVC 1.0. It works fine for strings, int etc but not for DateTime, I get the exception cannot compare String to DateTime. The very simple test code is items = items.Where(string.Format(@" {0} > {1}{2}{1} ", searchField, delimiter, searchString)); Where...

MVC Ajax Begin form hides submit button on ajax call

I have a shoppingcart control that lists the items in cart. Each row has a delete submit button that is wrapped around ajax.beginform that will call the controller, delete the item in cart and render the shoppingcart as partialview. The ajax and deletion works fine in IE and Firefox. In firefox only, after the submit button is clicked an...

Full folder path prefixed to application root for MVC at GoDaddy

I am having a similar problem as described here: stackoverflow.com/questions/364637/asp-net-mvc-on-godaddy-not-working-not-primary-domain-deployment I have multiple domains pointing to different folders. Each folder is set as an application root in IIS7 on GoDaddy's shared hosting. These folders are [ContentRoot]/websites/folder1, [C...

Modal View changes dimensions of original view?

I am specifying the dimensions of a UITabBarController, which is positioned at coordinates 0x 40y on the screen. I then call a ABPeoplePickerNavigationController to view a contacts list. I was able to specifiy the location of the contacts list to match the position of the UITabBarController. However, I am having problems restoring the UI...

Is it OK to put UI text in Rails model files?

I have a Rails form for editing objects of a particular class. The labels on the form need to vary slightly depending on which particular object is being edited. The obvious way to do this would be to add an instance method to the model objects to return the appropriate label for that object. However, this would appear to be putting pa...

How should separated controllers access the model?

Given that I've got any number of controllers, how should they access the data saved in the model? In a database driven application it's quite easy as all data can be fetched from one single object. Should there be a namespace / singleton / global object which allows access to the data? Should the model be passed to all controllers whe...

Problem Loading Xml File asp.net mvc

Heres my code: XElement navegacion; public Navegacion() { this.navegacion = XElement.Load(HttpContext.Current.Server.MapPath("App_Data/navegacion.xml")); } It works just fine when I go to: http://localhost/Default.aspx an when I go to http://localhost/Users But it cant open the file when I go to http://localh...

Jquery - how to get element that made the post

Hallo, I have following jquery code for calling ASP.NET MVC controller method that is returning the html created using Partial View. $("form[action$='ShowProperties']").submit(function() { $.post($(this).attr("action"), $(this).serialize(), function(response) { $(this).children("div.serviceproperties").html(response); /...

Help with passing an object back to post action please

...

Help with route rewrite in asp.net mvc

Im having a really hard time understanding routing. Please help me with this problem. Each of my controllers have these three actions right now Users have Index, Create and Edit Locations have Index, Create and Edit Companies have Index, Create and Edit The thing is, it all gets done through ajax. I have jquery ui tabs with two t...

When to include helper methods in a model (MVC)?

I think the easiest way to ask this question is with the actual real-world situation I'm facing. In our system, we have a Site model (classic MVC framework here) that represents a row in our site table. One of the fields of the site table that is stored in the Site model is the time zone of the site. We use this to adjust UTC datetimes ...

Unit testing using Moq, Code using Linq to Sql to stored procedure

I am very new to TDD, ASP.NET MVC and LinqToSql. I am trying to write tests for my repository, which gets data from stored procedure using LinqToSql. This is the repository method being tested: public int GetResponseCount(int campaignId) { var results = (new MyDBDataContext()).GetResponseCountById(campaignId); foreach (GetRespo...