asp.net-mvc

Inserting data based on ParentID, strange behavior ASP.NET MVC ?

Hi, I have a simple form which inserts a new Category with the given parentID (ServiceID). and my parent child relationship is this; Service > Category my url for creating a Category based on the ServiceId is this /Admin/Categories/Create/3 => "3 is the serviceID" and my Action method is this [AcceptVerbs(HttpVerbs.Post)] pub...

Linking to location on page (#id) through ASP.NET MVC mechanisms?

My example: I have a View that presents a set of div tags that has content populated from the datamodel. [Multiple of these, with different location_id, naturally] <div> <a name="location_id"></a> Content </div> Now, I have a form [in its own view] that submits content that adds another record to the datamodel. Once the reco...

Providing View name to PartialViewResult

When doing return PartialViewResult(string viewName, object model) where does the constructor for PartialViewResult look for a View? For instance, if we have two views with the same name in our Views folder (at different locations, of course). Which one he picks up? What if we have two views named Create.aspx and Create.ascx? Does ...

Spark Mvc2 RC layout issue

I got Application.spark and home.spark views. If layout has: <span><use content="view" /></span> And home has: #RenderPartial("partial") And partial has: <div>test</div> Then rendered output will be: <div>test</div><span></span> Any ideas what's wrong? Using this spark version with updated System.Web.Mvc assembly. ...

In asp.net MVC2 using unity does my program need to manage the lifetime of the container?

I'm putting the unity container creation/setup in the global.asax. and making the container a static property on that class since i'm not sure how unity works or if the container needs to be kept alive and references elsewhere. What's the recommended location of unity initialization/configuration for mvc 2? ...

checkout process workflow, having issues with redirects

My checkout process has the following workflow: checkout page shipping address edit shipping address(add/edit) delivery method payment place order Each of the above steps has its own action in the same controller. Now the issue is, if the person gets to #5, and wants to edit the address, they go back to #3. But when they hit submit,...

Deploy ASP.Net MVC solution to Windows 2008

We have a ASP.Net MVC project that runs fine on our developer machines. When we try and run it on a Windows 2008 machine we get the following error: Error This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set e...

asp.net MVC: reroute to action in custom action attribute

Hi, i'm trying to create an attribute that i can set on my controllers action in which i can check if a user in some kind of role. I know with standard asp.net authentication this is already possible, but i'm not using that. So what i want to accomplish is this: [Role("Admin", "SuperUser")] public ActionResult SafeCourse() I've cons...

.NET - Efficient collection of database entities?

I have a Page class and a PageCollection class in a 3d party ORM framework. I can fill the PageCollection based on parameters (pageid, parentid, url etc..) (SQL query). But I need the data multiple times around the ASP.NET MVC website (Sitemap, Authentication), so I chose to load all pages 1 time and reference that (global) collection. ...

ASP.Net MVC Application on Windows Server 2008 uses static file handler

I have just installed a ASP.Net Mvc application on a windows server 2008. When I try to use the application I see that IIS 7 tries to use the static file handler, I therefore get a 403 or 404 error. How do I get it to use the MVC handler? EDIT Have also tried asking this question on serverfault. It has a bounty here ...

How to tell a DataContext to ignore specific fields when updating a record?

I recently worked through Steve Sanderson's Pro ASP.NET MVC Framework and ran into an issue with the sample "SportsStore" application. SportsStore is a simple CRUD app that provides an editor to insert and update products in the store. Each product can have an image (which is stored in a SQL Server database, I know, maybe not the best id...

Odd RoleProvider Behavior

I have a roleprovider set up as follows using a DataContext. On my View, I have the following user Control... <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <% if (Request.IsAuthenticated) { %> Welcome <b><%= Html.Encode(Page.User.Identity.Name) %></b>! <%= Html.ActionLink("Logout", "Logout", ...

Asp.Net MVC Authorize Options

Have an application were 99% of the actions will require user to be logged in. The options I've come across are - 1-)Create a base controller inheritance chain and apply authorize attribute at that level. Something like: BaseController > AuthorizeController, BaseController > PublicController. (don't like this because of the inheritance...

Set windows authentication for an MVC route?

I want most of my site to be Forms Auth, so IIS must allow for anoymous users. However I alsowant windows on the domain to be able to skip logging in. So I'd like one route "/Login/WinAuth" to be set as requiring Windows auth. if this was a .aspx file I'd just change the security of the file in IIS and be set. But when using MVC I don'...

Using ASP.NET MVC Html Helpers in a standard web forms project

So for example in the code behind of a web form aspx page I would like to be able to do things like string textBoxHtml = Html.TextBox("MyTextBox"); Is this possible? Is the source code available to fork for webforms? ...

Exception message to UI

Hello, I open a jQuery dialog, in this box I do a save/cancel. To Save, I call my controller, make some validation, save or throw Exception (MyPersonalException). If there is exception, I return an another View (the "MessageError" view) to display in the popup. I just want to see in the modal box the message available in "MyPersonalExce...

Asp.net MVC Controller Index method doesn't fire on Redirect from another controller

public ActionResult Index() { var tickets = DependencyContainer.DomainController.ShowTickets(); if(tickets==null) { ViewData.Add("Error","Associate not found"); return RedirectToAction("Index", "Home");//Doesn't fire the index? } return View(); Home contro...

How to start up with jQuery in ASP.Net MVC?

I know C# really well, just started playing with ASP.Net MVC a few weeks ago, and almost zero javascript. I saw some people here recomending jQuery, so I'll try that out. What resources/tutorial should I start with? ...

Asp.Net MVC Identify Site via Url

I have an application that will support multiple sites. The site will be determined based on the url. For example http://myapp/site/abc123/... and http://myapp/site/xyz123/... The site code will drive a lot of the functionality for example themes, available modules, etc... Questions: 1-)I need to validate the site code is valid and...

ASP.NET MVC radiobutton not working in the parent view to call partial view

Hi I have two strongly Typed partial views (Developers list and Testers list) and the respective views are Developers.ascx and Testers.ascx Now I want to load one partial view based on the radiobutton selected. The below code is not working on radio button change. Code Snippet: $('input:radio[name=Type]').change(function() { var u...