asp.net-mvc

asp.net MVC:hierarchical domain model and controllers

My domain model is this: we have a bunch of schools as the root of the "hierarchy". Each school has teachers and courses, and each course has one teacher. I am trying to model this with the logic of the mvc framework and I 'm quite confused. For example, the \school\details\x should give the first page of a school. That should contain a ...

How do you Make a URL string in asp.net MVC

I am trying to make a url string to one of my mapped routes in the CS file. I can do it in the aspx file via the html helpers. How do you make a url in the CS file? ...

ASP.NET MVC app hosted on GoDaddy has SecurityException

I'm trying to get an ASP.NET MVC app working on GoDaddy ... I should have known it wouldn't be easy. The first few pages work, but they are all static. The first time a Controller is executed I get the exception below. Here is the Controller action method: [AcceptVerbs(HttpVerbs.Get)] public ActionResult Index(Section? section, int? pa...

How can I generate a URL within a shared (static) method in MVC.NET?

I'm creating a Shared (static) method in ASP.NET MVC so it can be used by any controller in my project. This static method needs to generate a URL. I think I need to use System.Web.Mvc.UrlHelper, but I can't figure out how to call it from within a static method. The constructor seems to want a RequestContext. Any ideas? ...

Concating Querystring in ASP.NET MVC

Hi All, I'm using ASP.NET MVC for the first time and so far everything has been going great. However, one little question I was hoping someone could advise me on. When a page can perform multiple tasks and each is handled on the server by assessing querystring values what is the recommended solutions for building up the querystring ove...

NHibernate compromising domain objects

I'm writing an ASP.NET MVC application using NHibernate as my ORM. I'm struggling a bit with the design though, and would like some input. So, my question is where do I put my business/validation logic (e.g., email address requires @, password >= 8 characters, etc...)? So, which makes the most sense: Put it on the domain objects the...

Where can I find Amazon DevPay C# Sample Code that works?

I am trying to code an small application that will utilize Amazon DevPay and I am having difficulties sending a few sample requests and getting errors. Looking for library class in c# that will conceal all the details. Currently playing with the sample C# library by Amazon but having no luck. any other will be appreciated. This link ...

How to write my own AuthorizeTag?

Hi I ditching asp.net membership so I am guessing I need my own authorize tags(correct me if I am wrong). Since probably the ones they have all point to the membership classes(Not sure how to verify this though). Now I tried to do this public class MyTest : AuthorizeAttribute { protected override bool AuthorizeCore(HttpContextBase ht...

Can Visual Studio always open ASP.NET pages in Source view, not Design view?

Anyone know how to tell Visual Studio 2008 to always open up ASP.NET pages in "Source" mode, not "Design" mode? ...

So very very confused about Authentication in asp.net mvc

Hi I come to the conclusion I need to ditch the ASP.NET Membership (for list of reasons). Now really the only thing I see that I need is creating a cookie(done by Form Authentication), custom methods for authentication (done) and finally validation based on if they are logged in or by role. I am stuck on the last one. I am trying to...

How to grant write access to a folder in ASP.NET MVC site with IIS7?

Hi, As the title says. Can some give me instructions how to do this as I cannot see how. I am used to IIS5 & 6. Also when I try to add write access to the folder in explorer there is no Add option to add a user ie ASPNET account. This is on Vista Malcolm ...

[asp.net mvc] xVal Cliend side validation with ajax, RenderPartial form

Hi there I'm not sure if my issue is more general or only xVal specific. At the moment I have a form with an undefined list of partial forms Something like this. There I load a partial form with Ajax, with xVal I attach also a validator. My problem now is that the rendered form is not validated until a postback. Is there any possibil...

Autoposting Radiobuttons in ASP.NET MVC view

Hi, I'm trying to add a couple of radiobuttons at the top of a View (using ASP.NET MVC). I want the two radiobuttons (option 1 and option 2) to cause the page to be refreshed/autoposted when changed. The two radiobuttons live inside a separate .asxc (Menu.ascx), and added with Html.RenderPartial in a List.aspx page. The two options in ...

Add option to droplist

Hello I have a droplist, and I would like to add an All as the first one. How is that done with asp.net mvc? I have: <%= Html.DropDownList("selCustomerID") %> works great, but I don't have an empty "all-option". I populate it like this: return View("Index", new CustomerAdminEditViewModel { selCustomerID = new SelectList(_cs.GetCus...

Adding OnChange-post on droplist?

Hello How do you post a form in mvc when changing the value of a droplist? do I have to add attributes or is there some inbuilt thing? Thanks /M ...

ASP.Net MVC in shared hosting environment

It's a very simple question, but I wasn't able to find exact answer. Do you need to install anything extra besides .Net Framework 3.5 and IIS7 to run ASP.Net MVC applications? Hope it will be useful to other people too. ...

Building custom shaped view model for asp mvc framework

Hi everyone, I am building my first few projects with ASP.NET MVC, and I have a list of items that come from 2 tables. Using the nerd dinner example, this is my problem. Lets say I want to have all the dinners, with all the rsvp information in a list on one page. So it would go dinnername1 rsvp1 rsvp2 dinnername2 rsvp1 rsvp2 rsvp...

ASP.NET MVC Model Binder for Generic Type

Is it possible to create a model binder for a generic type? For example, if I have a type public class MyType<T> Is there any way to create a custom model binder that will work for any type of MyType? Thanks, Nathan ...

Asp.net semi-authenticated user?

We've got an asp.net mvc website that is currently in a private beta state. As such we are sending out invite codes that must be supplied as part of the registration process for registration to succeed. We'd like to reduce the bar of entry such that users only have to supply the code to gain access rather than going through a more labori...

What is the difference, if any, between string.Format and TagBuilder in ASP.NET MVC?

Hello SO: I have a Html Helper file for my ASP.NET MVC application. The majority of them simply return a formatted string. Here is an example of one of my formatted string helpers: public static string Label(this HtmlHelper helper, string @for, string text) { return string.Format("<label for \"{0}\">{1}</label>", @for, text); } ...