asp.net-mvc

Why is my JSON which contains HTML causing errors?

My JSON that is being returned from my ASP.NET MVC application looks like this: {code: "1", error: "0", output: "<div class="a1"><div class="b1">this is fasta's</div></div>} It is not working because I am not escaping it properly. I'm not using a JSON library, can someone recommend a function that would clean up my HTML so this works...

Using jqGrid userdata

I have a jqGrid on an ASP.Net MVC view. I want to use to pass the value of a hidden text control on the page as an additional parameter to a jqGrid method. I have the following hidden text field: <div> <%= Html.Hidden("contactId", Model.ContactId) %> </div> and I want to do something like: userdata: {contactId : jQuery('#contactId')...

Finding the right caching and compression strategy for asp.net

I'm trying to figure out the best way to do caching for a website I'm building. It relies heavily on screen scraping the wikipedia website. Here is the process that I'm currently doing: User requests a topic from wikipedia via my site (i.e. http://www.wikipedia.org/wiki/Kevin_Bacon would be http://www.wikipediamaze.com/wiki?topic?=Kevi...

I have to run a function at the beginning of EVERY action, is there a way to make a generic "thing" ?

I tried to use the Sub New but it I don't have access to the url information what I have is something like: function Index(byval lang as string) as action result setLang(lang) .... return view end function function List(byval lang as string) as action result setLang(lang) .... return view end fu...

Is ModelState and AddModelError persistant in a Controller/Action?

My controller actions: [AcceptVerbs(HttpVerbs.Get)] public ActionResult Login() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public ActionResult Login(string UserName, string Password, bool RememberMe) { var userNameValidationResults = _validatorProvider.Validate<IMailAddressValidator>(Us...

How to get Elmah working with ASP.NET and IIS 5.1 URL Routing

I am having issues with regards to running my ASP.NET MVC application thru my local IIS 5.1 web server. I believe these issues are related to IgnoreRoutes, but I can't seem to craft an IgnoreRoute such that it resolves the problem. Problem: I am able to view my elmah error page (localhost/mvcapplication1/elmah.axd), however, the CSS i...

ASP.NET MVC Dependency Injection with UnityContainer Session State

Hi, I have a asp.net mvc web site where I make use of the Dependency Injections features of the "Micorosoft.Practices.Unity" and "Microsoft.Practices.ObjectBuilder2". This all works great by injected my objects into my controllers constructors. The problem is that I am having difficulty in clearing this session when a user leaves th...

Examples/Use-Cases of building your own ControllerFactory?

Out of interest: In ASP.net MVC you can roll your own ControllerFactory. I just wonder why you would want to do that? I see dependency injection mentioned which makes sense to roll your own ControllerFactory, but then again I am not sure why I would want to use DI on the Controllers. Swapping out the Model makes perfect sense, swapping ...

What is the simplest way to change the image of the selected tab in ASP.NET MVC?

I've seen this question, An easy way to set the active tab , however I'm not sure this is an optimal solution. I'm looking to see how others have handled tab selection in their views/controllers in ASP.NET MVC. What is the simplest way to implement selectable tabs in ASP.NET MVC? I'd like to avoid javascript methods to allow for non...

Where can I find a list of escape characters required for my JSON ajax return type?

I have an ASP.NET MVC action that is returning a JSON object. The JSON: {status: "1", message:"", output:"<div class="c1"><div class="c2">User generated text, so can be anything</div></div>"} Currently my HTML is breaking it. There will be user generated text in the output field, so I have to make sure I escape ALL things that need t...

Does asp.net MVC need to be complied before it’s deployed onto a web server?

Apologies if this is a strange question, though I can’t get a basic MVC site to work on my web server unless I’ve complied it first in Visual Web Developer. If it doesn’t have a dll in the Bin, it says the Namespace can’t be found. In classic asp.net I could just upload the files and the server would compile it at first run. Is this not...

Partial Validation ASP.NET MVC

I've read a number of articles now in regard to validation and asp.net mvc and the majority tend to point to validation in the model. The problem I see with all of them is that they don't handle different scenarios, or at least, they don't show how they would be achieved e.g. When creating or updating a user account the email address mu...

Get the Current User in asp.NET MVC so I can check what to do in User Controls

I am using ASP.NET MVC for a project. I use a lot of User Control and I need to check the current user and the check if it has the roles etc, now I create the user in every UserControl I see the Permissions. I want to change that so I create it only once. the Question is Whta is the best aproch? viewData["User"] = user and the get the ...

Dynamic LinqToSQL pivot table query

Hi All http://img7.imageshack.us/img7/3050/downtime.png I have two calendar pickers ( To and From ) I need to build the Year1 -> 4 dynamicly. I am also getting dupplicate records for 1 items that have values for 2006 and 2009. They can select 100 years if they wanted too.Check attached image. public ActionResult DownTimeSummaryTabu...

How can I implement tabs in ASP.NET MVC using query strings?

Duplicate: How can I build a tabbed menu in ASP.NET MVC? If you hover over the tabs of Stackoverflow, you'll see query strings like "?tab=hot", etc... I'm looking to do something similar, and could use some pointers: How can I select tabs based off the query string in ASP.NET MVC? Should I process this in a view, or in a contr...

Does Impersonation work in ASP.NET MVC

I am having issues with Impersonation in an ASP.NET MVC application, and just want to check if there are any known issues. Thanks. ...

Does this seem like an alright approach to implementing tabs in ASP.NET MVC?

After looking at how the Orange Tabs ASP.NET MVC demo handles tabs, they have something like: View: <ul id="menu"> <% if (Html.IsCurrentAction("Index", "Home")) { %> <li class="active"><%= Html.ActionLink("Home", "Index", "Home")%></li> <% } else { %> <li><%= Html.ActionLink("Home...

ASP.NET MVC Value cannot be null Parameter name: httpContext

Hi There, I have downloaded Storefront asp.net mvc application. When I try to run the application, I get following exception: ArgumentNullException - Value cannot be null. Parameter name: httpContext I just don't understand it. How do I fix this error? Thanks -Hitesh ...

ASP.NET MVC: Retrieving form fields with the same name

Is there are way to retrieve form fields with the same name besides using modelbinders or comma splitting. I have a few textfields with the same name and i need to loop through them and retrieve each value. Thank you ...

ASP.NET MVC + Complex ViewData

Hi Guys I want to expose data to a view. Where the user select from (2006) to (2009) The data will be SupplierName,PlantName,2006,2007,2008,2009 data. The user can also select from (2008) to (2009) THhen the data will be SupplierName,PlantName,2008,2009 What will be the best way to create viewdata class for this? ...