asp.net-mvc

ASP.Net MVC Controller causing Not Found error when deployed to ISS 7

Hi there, Actually, I am developing a website using ASP.Net MVC 3.5. I have a method in the Home controller which returns a partial view when called. The issue is when I am calling the controller method using jQuery, the Not Found (404.0) errors comes. All this happens when the application is deployed on ISS 7. It works fine during deve...

ASP.NET MVC - Back Links Wrong URL

For some reason when going back a link, i.e. hitting the back button in your browser takes me to the wrong link in my application. I've got a path of: http://localhost:3340/Accounts/ContractsControl/GeneralContracts and on that page I click on a link which takes me to http://localhost:3340/Accounts/ContractsControl/GeneralContractVi...

Return FormCollection items with Prefix

How can return a subset of a FormCollection with key/values in tact for those items with a certain prefix? I can do it for keys only but I need the keys and values. Thanks ...

How to get the values of an enum into a SelectList

Hi All, Imagine I have an enumeration such as this (just as an example): public enum Direction{ Horizontal = 0, Vertical = 1, Diagonal = 2 } How can I write a routine to get these values into a System.Web.Mvc.SelectList, given that the contents of the enumeration are subject to change in future? I want to get each enumera...

Dealing with checkboxlists and radiobuttonlists when POSTing forms

What is the right way of creating and processing a group of related controls on posted forms? From using ASP.NET MVC I see a standard option is to create a number of inputs and assign the same "name" attribute value to them. Like this: <input name="OrderOptions" type="checkbox" value="1" /> <input name="OrderOptions" type="checkbox" va...

I can't turn off Request Validation for an ASP.NET MVC Controller

I am trying to turn off Request Validation for all action methods in a controller by doing this: [ValidateInput(false)] public class MyController : Controller { ... The reference I am using says this is possible and tells me to do it this way, but for some reason it's not working. If I submit any html (even a simple <b> tag) thro...

Custom Authroization w/MVC

I am writing a web app using MVC and the first page will be a login screen. What is the best way to setup an authorization off of this first page to provide authorization for the entire session. The login information will be held in a database which will be half pulled from an HR db and an AD db. Thanks ...

ASP.NET MVC Add View Dialog missing options

i am following the NerdDinner tutorial http://nerddinnerbook.s3.amazonaws.com/Part4.htm and have gotten to "Adding a View" (middle of the page). When i right-click the controller and select "Add view", i get a dialog that is mising the "View Content" and the "ContentPlaceHolder ID" options. Does anyone know why i cant see these option...

How to pass XML as POST to an ActionResult in ASP MVC .NET

Hi, I am trying to provide a simple RESTful API to my ASP MVC project. I will not have control of the clients of this API, they will be passing an XML via a POST method that will contain the information needed to perform some actions on the server side and provide back an XML with the result of the action. I don't have problems sendin...

What is the most usual way to develop views in asp.net mvc?

What is the most usual way to develop views in asp.net mvc? Should I be using a view engine other than the default? As far as I know, StackOverflow is the bigger site using ASP.NET MVC, so, what they use? In the pros of using view engines, it seems like they are easier than the default. In the cons, it seems that they break the original...

How to return JSON structure in ASP MVC

i need to return a JSON with this format: {"answers": [{"id": "93", "value":"Ahstron"}, {"id"="94", "value"="Sampers"}]} Im using the return Json() method form ASP MVC Framework, is there a way to specify that this JSOn is a collection of answers like in the sample code? or must i create my own? with the return Json(a...

Number of Rows MVC Contrib Grid

Hi, I'm using the Contrib Grid for ASP.NET MVC and I was wondering if there is a way to get the number of rows to be output from the grid renderer? I'm trying to not add stuff from the renderer if there are no rows that are going to be shown. Thanks ...

Does an 'Account Activation' workflow exist for ASP.NET MVC

I need to implement the common 'New Account' pattern (in .net MVC) where: user information is collected; my system sends an email; and the user if required to reply to the email to activate the account. Is there a best practices recognized or sample site that can guide my way? thx much EDIT: Note that i'm trying to drill into a dee...

How to set navigation variables in MVC Masterpages

I need to have some navigation options, that require keys that are specific to the current user, that reside in a masterpage. I need some advice on best practise. In have the following links in a left nav in a masterpage http://www.example.com/manageShop/123 http://www.example.com/addProductToShop/123 http://www.example.co...

treeview with Checkbox - MVC

I need to show a treeview with checkboxes to select in MVC with C#. I have two tables. one with categories and subcategories and the other one with products. Some categories wont have sub categories in the first table, they'll have only products. I need to populate the Treeview with these two tables. Please suggest me to do it in MVC a...

"ASP.NET MVC" CMS in Sharepoint Services

I'm evaluating the options for a CMS in ASP.NET MVC. I'm currently working on a multi-tenant app that requires CMS funtionality. I've been looking at N2, Mojoportal etc, but I'm also interested in what SharePoint Services could bring to the table. Specifically I don't want a SharePoint site but rather I'd like to potentially use the shar...

Access the website settings of an asp.net mvc app stored in a database table using NHibernate

I have an ASP.NET MVC app which depends on a lot of settings (name-value pairs), I am planning to store this information in a database table called SiteSettings. Is there an easy way in which I can get these settings using NHibernate. And what are the best practices when saving settings for a web application. And by settings I mean the s...

ASP.NET Model binder question for updating child table

I'm using Linq to SQL within an ASP.NET MVC application. The model consists of a Decisions table with a foreign key link to an Options table (one decision, many options). So the Model allows me to access the Options collection through the Decision.Options property. I want to allow my users to update the Options collection for a Decisio...

asp.net mvc html.password set value

Hi all, I've got a html.password helper control on an edit profile type screen. Is there a way to set the value of this when the page first loads so that if the user doesn't want to change their password, the existing one gets passed back to the controller. Thanks Nick ...

I created my own view state facility for MVC. Good or weak practice?

Ok, I admit it - I wrote my own view state facility for ASP.NET MVC. I am interested in others' critique, especially given all the view state bashing associated with WebForms. On the other hand, in Pro ASP.NET MVC Framework (p405-406) Steven Sanderson says "I feel that as a general web design pattern, [ViewState] is completely sound: web...