asp.net-mvc

How to turn off MVC.NET version 2's RequireHttps attribute?

I see that version 2 of MVC.NET now has a RequireHttps attribute, which works great for me. However, what's a good strategy for turning the effect off? For example, I want to use Https on some pages, but regular Http on others. Should I create my own RequireHttp attribute? EDIT: I'm using my own RequireHttp attribute, and it works fi...

Asp.Net MVC Routing - how do I match the whole URL?

I'm trying to create a catch-all route to track when an affiliate string is in the URL. An affilite code is marked by an x followed by an int, and will only appear at the end of a URL (but before the query string). The idea is that I will extract the affiliate ID, do some logging, then do a 301 to the same request without the affiliate ...

catching input image value in controller using IE

How do I catch the value of an image button in a controller. I have: <input type="image" id="savebutton" name="savebutton" value="next" src="..." /> In my controller I have [AcceptVerbs(HttpVerbs.Post)] public ActionResult BillingShipping(string savebutton) { ... } This works in Firefox but not in IE. Howeve...

ASP.NET MVC routing and areas

I am messing around with ASP.NET MVC 2 Preview 2 and am trying to figure out how routing works with areas and such. In a single project implementation of areas, I want an area named "admin". I am trying to be able to have urls like this: (root)/admin/apples/search (root)/admin/apples/edit/3 (root)/admin/apples/add (root)/admin/oranges...

How to have a sub view in MVC?

Hi there I am quite new with this MVC in ASP.NET. If I have a page which has Tournament class (in Detail mode) and underneath it has a list of PlayRoundHoles class which it's comes from stored procedure due to a complex quiry. How do I achive this to display this list under Tournament Detail View? I don't quite understand where this Pl...

Nested insert in Linq to SQL?

How do i put a nested insert into database using Linq to SQL my Table is like this: [Post] --Post ID --Post Title [Attachment] --Post ID (PFK) --AttachmentID (PK) --IMGID (FK) --VIDID (FK) [IMG] --IMGID (PK) it's a M:N table basically when i submit a form , it go together with the attachments within the form. Im ok with insert Pos...

ASP.NET MVC models when using external web services

I'm getting started on a new MVC project where there are some peculiar rules and a little bit of strangeness, and it has me puzzled. Specifically, I have access to a database containing all of my data, but it has to be handled entirely through an external web service. Don't ask me why, I don't understand the reasons. That's just how it i...

ASP.NET MVC - Verify the Existence of a Route

My ASP.NET MVC application has a scenario where user input can directly influence the target of a call to RedirectToAction() (by way of a string) and there is a chance that the user could create a run-time error if improper input leads them to request an action that does not exist. I'd like to prevent this problem outright, but I'd like ...

Upgrading MVC project in VS 2010 b2: The project type is not supported by this installation

Consider the scenario of upgrading an ASP.NET MVC project. This question is around up-converting a .sln with a .csproj that is of type ASP.NET MVC 1.0. The conversion log shows this The Visual Studio conversion wizard log gives this exception: The project file 'C:\MvcForums\MvcForums.csproj' cannot be opened. The project type i...

What would you like in a CMS?

As the title says, what would you guys like an a complete CMS? Both as a user and as a developer. My current idea is to implement the whole thing in C#/ASP.NET MVC 2 and use StructureMap to load new componentes/plugins during runtime, so people can drop a pluginaName in the ~/Plugins catalog and have that loaded. But what I want you to...

Updating a table's ActionLinks in MVC using JSON and JQuery

I have the follwoing HTML to show image actions inside a table element: <%= Html.ActionLink("[EditImg]", "Edit", new { id = item.GrossBaseReconId }, new { id = "BaseReconEdit", rowsid = item.GrossBaseReconId }).Replace("[EditImg]", "<img src='/Content/images/page_white_edit.png' alt='Edit Details' title='Edit Details'>")%> <%= Ajax...

Using named parameters as controller input versus FormCollection

I'm new to ASP.NET MVC so this could have an obvious answer. Right now I have a form in my view with a lot of input controls, so I have an action that looks like this: public ActionResult MyAction(string formItemOne, int? formItemTwo, etc...) It has like a dozen parameters, which is pretty ugly. I'm trying to change it to this: pub...

Custom ViewEngine required?

Hi, i have a website that will have customized designs, depending on what "store" was clicked on... So, i have a folder structure like: + _default - Site.Master - Site.css + Views - main.ascx - xyz.ascx - zbf.aspx + custom_design_01 - Site.Master - Site.css + Views - xyz.ascx - z...

ASP.Net MVC with Date Picker Postback

I need to setup an ASP.Net MVC view with a Date Picker that will send a postback to the controller when it is changed with its new date. I know there is a Date Picker in JQuery, but how would i get it to send the data to the controller? ...

How to bind dropdownlist in ASP.NET MVC?

Hi all How to bind dropdownlist in ASP.NET MVC? Here's my controller: public ActionResult Create() { DB db = new DB(); var t = db.Players.ToList(); MyPlayRoundHole model = new MyPlayRoundHole(); model.MyPlayers = t; return View("Create", model); } and in my view: <tr> ...

Internal Server Error due to config lockdown when deploying my ASP.NET MVC app to my web host

I'm developing an ASP.NET MVC website on a local Windows Server 2008/IIS7 machine and am I'm now attempting to deploy it to my web host provider, ASPnix. I'm using their Shared Web Hosting service and have been placed on an IIS7 server which they claim supports ASP.NET MVC. However, when I deploy the application up to their servers, I ...

validation summary xVal 1.0 with MVC

Can i add validation Group for Validation Summary? Here my intentsiion is to display the validation summary like this: if in case Model has two items. i need to display summary liek this validationsummary0 summary1 summary2 summary3 All my controls set 1 validationsummary1 summary1 summary2 summary3 All my controls set 1 b...

change div id using jquery

How to change the id of the div using jquery? I have div with id (initially as 'first') and a dropdown (with values 'first', 'second'). On changing the dropdown value, i need to change the id of the div according to dropdown value. ...

ASP.NET MVC: deal with user input (recoverable) and absent data (non-recoverable) errors

Suppose I have this model: public class ViewModel { [Required] public string UserInput { get; set; } [Required] public Guid EntityId { get; set; } } Now, when UserInput is wrong, I want to re-display the same page but with validation errors (e.g. /Edit). However, when EntityId is wrong, I want to redirect to some other page (e...

Keeping track of loaded scripts per page using ViewData

Hi all, I'm currently trying to find a good way to load my javascript files only when I need them. In order to do this, I created several HtmlHelpers for faceboxlinks, datepickerfields, tinymcefields and other scripts that need an external js and an initialisation jquery expression. In these helpers I execute the script using jQuery's g...