asp.net-mvc

How to represent a hierarchically-organized URL in ASP.NET MVC

Let's say I have an URL that looks like this: http://www.mysite.com/area/topic/subtopic/subsubtopic where the number of topics and subtopics is arbitrary. Is there a way to process this kind of URL in ASP.NET MVC? ...

Troubleshooting the addition of MVC to an ASP.NET WebForms application

I have an ASP.NET WebForms application that I'm trying to switch to MVC for new development. I'm generally following this tutorial plus Google and Stack Overflow. The setup has been "easy", but for some reason I can't seem to get the first MVC controller/view to appear. My first thought was that I had a problem with the routing, so I in...

ASP.Net MVC - Build a load on demand TreeView

I am wondering how to build a load on demand tree view using ASP.Net MVC. I understand what is involved in creating a JQuery TreeView using lists, but the load on demand part is really confusing me. I don't need the full solution, but can somebody point me in the right direction on where I should start? I have done these plenty of tim...

Asp.net mvc output cache don't work with RedirectToAction.

For my case, i have a controller, which query then forward the user using RedirectResult, which actually did a header "Location". Then i apply the cache to the controller like this [OutputCache(Duration = int.MaxValue, VaryByParam = "none", NoStore=false)] I try to re-run the page, and I check on my Linq profiler, I still able to see...

Simple MVC Question for MVC beginner

hi, i have an Ajax ActionLink which normally just returns a PartialView (which is just a UserControl ascx file) however, my needs have changed and i want to return another PartialView (so a total of two PartialViews) that occupy different areas of my page... of course i can't call " return PartialView("UserControl.ascx") " twice in a ...

Alternative to ValidateInput("false") when passing HTML to a controller

I have a pretty simple ASP.NET MVC page and am using TinyMCE to allow users to enter comments. However, when I pass the data to a controller I receive the following error message: A potentially dangerous Request.Form value was detected from the client The consensus is that ValidateInput("false") should be set on the Action method...

Problem with loading inline javascript in a PartialView

This question relates to my previous question which asks about loading a page into a DIV asynchronously using jquery/ajax. It has been resolved and it works like charm :). Now the problem is in the View that is asynchronously loaded to the DIV , I'm having a partial view. The partial view intern contains some javascript. When I load the ...

Web History and ASP.NET MVC with AJAX

Having a site where you can search with the below snippet, how do you store the history for each search so that a user can press the back-button to get to previous search results and have a populated text-box with the searched values? <% using(Ajax.BeginForm("TestSearch", new AjaxOptions { UpdateTargetId = "details" })) { %> ...

How should I run a background service for creating export files for a web site in the Windows world?

I've created a shiny new ASP.Net MVC site and I have offloaded the 'save as' type of functionality to a helper program that can be run in the background on the server so that the website doesn't need to take all that load. I created it so that it's easy to run from the command line and right now I have it running from a windows schedule...

asp.net mvc - multiple databound components on a page

Hi, Im new to asp.net mvc and just learning the basics right now. Im wondering how pages with muliple databound items would work with mvc views. for example say there is a page that lists a bunch of "news articles" from a "NewsArticles" table. and in the side of the page there is a another list which contains a list of "CaseStudies" f...

Why are some HtmlHelper methods implemented as extension methods

I'm currently creating some custom helper classes, similar to ASP.NET MVC's standard HtmlHelper. When I looked at the implementation of HtmlHelper, I noticed that most/all of the HTML generating methods (such as ActionLink(), BeginForm(), TextBox(), and so on) are not implemented directly inside the HtmlHelper class, but as extension met...

ASP.NET Site Templates

Are there any good ASP.NET site templates out there? I am looking for something with some very basic features: Reusable layout Navigation already built in Admin Section Login Page I was going to build a template that meets my needs exactly, but thought I would scour around a bit first. If I don't find something that does what I ne...

How do I get the id of the control calling the jquery autocomplete function?

I want to use the jquery autocomplete plugin across several input boxes. In order to keep my code DRY I want to tie the autocomplete function to a class and within the autocomplete function pass the id of the field that has called it as an extra parameter. What I am struggling with is obtaining the id of the field that has called the fun...

Exception with lambda express

Hello, I have a strange behavior. The code below worked from a long time but nowI don't know why I didn't change anything, I have an exception. I get employee from my database via Nhibernate, the _model.List have the employee list. I have an exception on the line juste before the return (where I build the array). I format the data to us...

Call a public method in Controller from the View in asp.net MVC2

I have a method in the controller which returns a string. I need to call this method from my view to get the string and show in the view. I am using MVC2. how can i call a public method in controller from the View? ...

ASP.NET MVC Exception?

Hi, since today i get an Exception on IIS7.5 with ASP.NET MVC, but i dont know why. It occurs while using System.Net.WebClient.DownloadString() [WebException: The remote server returned an error: (500) Internal Server Error.] If I open URL in Browser. Site shows up fine. In VS2008 Debug Trace Status is: "200 OK" The only thing it ...

Spark-View-Engine with ASP.NET MVC2

How do you modify a ASP.NET MVC 2.0 project to work with the Spark View Engine? I tried like described here: http://dotnetslackers.com/articles/aspnet/installing-the-spark-view-engine-into-asp-net-mvc-2-preview-2.aspx But somehow it still tries to route to .aspx files. Here the code of my global.asax: public class MvcApplication : Sy...

ASP.NET MVC check if user belongs to [x] group

Maybe I'm approaching this the wrong way and should be doing everything in action filters, in which case please point me in the right direction! I'm setting up my ASP.NET MVC application so that the one HomeController Index action delivers two different types of content, like so: if(Request.IsAuthenticated) return View("IndexRegister...

mvc modelbinding

hi, I have an Edit action/view for my User object, but only want a few fields to be editable. I've set up the view to bind to the User object, and am using Html.EditorFor() for the few fields that I want to be editable. I noticed in my User object on Post: [AcceptVerbs(HttpVerbs.Post)] public ActionResult EditUser(Mynamespace.User u...

Using web.config to store and map info

I've been reading others questions regarding storing settings in the web.config. Most of you agree that's a good way to store settings. I just have another doubt about that. In my app, I need to map some ID's in the web.config. For example: [Table = UserType] 1 - User /2 - Admin Is it a good idea to store these settings in the web.co...