asp.net-mvc

Why are my aspx pages not being cached on the client?

I have a dynamically generated CSS file. It's fairly large, and has different content for different browsers. It changes very rarely. So at the top of the .aspx page I have: <%@ OutputCache Duration="86400" Location="ServerAndClient" VaryByParam="none" VaryByCustom="browser" %> I hav...

ASP.Net MVC 2 - drop down list that controls a grid

I am just starting on MVC so this should be an easy question to answer. I am using MVC 2 for ASP.Net. I have a drop down list which when changes should cause the grid to change as well. I have found a way to catch the change selection event and refresh the whole form using the code below. The $('#TheForm').submit(); command causes the In...

ASP.NET MVC validation in weakly typed views

Hello. I have a problem validating data on view that is not strongly typed. I'm updating data from 3 different models on that view, and I have validation methods that work on them, but I don't know how to display the validation message. Where should I put validation messages (for strongly typed views I put them in ModelState, I presume...

Errors when creating a custom Querable object with MVC and Subsonic pagedlist

hiya, i have the following code but when i try and create a new IQuerable i get an error that the interface cannot be implemented, if i take away the new i get a not implemented exception, have had to jump back and work on some old ASP classic sites for past month and for the life of me i can not wake my brain up into C# mode. Could you...

ASP.NET MVC form GET passing array

I have a form with a collection of checkbox's for a refine search function on my website. I am trying to pass an array in a form GET but the URL looks like: /search?filter=foo&filter=bar&filter=green Is there a better way to pass this in MVC? Possible like /search?filter=foo,bar,green Thanks in advance. ...

Using Quartz in an Asp.Net MVC environment using NHibernate Burrow

I have a web site running Burrow, and I'd like to use it for Quartz jobs as well. The thing is that I want them to not share any state. The Quartz jobs is running in each own threads while the Mvc framework closes the Workspace at the end of every request. Ideally, mvc should have it's own session, and each job should have it's own sess...

How do I display video in my view? - ASP.NET MVC

I am using asp.net mvc, and I'd like to add media player control in my view page, so how do I do that? ...

host MVC app inside a website

I have a website (not a web application- in visual studio you get two options-create a website/project) running on IIS 6.0. Now I want to develop few features in MVC architecture. So I created one MVC application in visual studio and everything is working fine on localhost as a separate application. Now I want to host this MVC app also i...

Can I use a static cache Helper method in a NET MVC controller?

I realise there have been a few posts regarding where to add a cache check/update and the separation of concerns between the controller, the model and the caching code. There are two great examples that I have tried to work with but being new to MVC I wonder which one is the cleanest and suits the MVC methodology the best? I know you ne...

Common MVC 2 Pitfalls

I'm surprised this hasn't been asked before...or maybe I just don't see it. Anyway, I'm finally straying from the comfort of ASP.NET Web Forms and exploring the world of MVC2. I've done the nerdinner walk-through and it was fairly straightforward. Now I am getting a little more adventurous and building an MVC2 app on my own and would li...

Something to dynamically Generate a UI to edit XML file?

I have an XML file with a lot of nodes similar to the following format: <Factsheet page="GenericOfflineFactsheet.aspx" pageTitle="MyTitle" > <TopStrapline text="BlahBlahBlah" /> <Commentary page="Text.ascx" /> <ChartPanel page="Bar.ascx" appearanceFile="Bar.xml" /> <Strapline text="blah blah blah" /> <Funds> <fund id="215"...

Multible jquery .load() methods not running concurrently in MVC 2

In one of my aspx pages i have something like this in the head: <script type="text/javascript"> $(function() { // Jquery stuff loadStuff(); }); function loadStuff() { $('#result1').load({ source: url }); $('#result2').load({ source: url }); $('#result3').load({ source: url }); }; ...

Asp.Net Mvc - Html.TextBox - Set Autofocus property

In Html 5, there is an new attribute on textbox call autofocus. The problem is it is a boolean value (there or not there) It should look something like : <input name="a" value="" autofocus> I try : <%= Html.TextBox( "a", null, new { autofocus } ) %> But, it's give me an error because I'm not setting a value to autofocus... I kno...

How do I install ASP.NET MVC 2 Futures?

I want to use the DataAnnotations.DisplayAttribute.Order property to arrange my fields when using the DisplayForModel and EditorForModel methods. Related question: Does the DataAnnotations.DisplayAttribute.Order property not work with ASP.NET MVC 2? I think that I need to use the ASP.NET MVC 2 Futures. But I can't get it to...

add color style to value based on condition

Hi All, How do I conditionally add the style 'color:red' to the .CurrentDifference if the value happens to be a negative value? Thanks, rod. <div class="sRow"> <div class="sLabel p40"> Difference: </div> <%= (!String.IsNullOrEmpty(Model.Amount)?Model.Amount.CurrentDifference.ToString("c"):string.Empty) %> </div> ...

ASP.NET MVC: How to find Controllers with [Authorize] attributes using Reflection in C#? (or How to build Dynamic Site.Master Menus?)

Maybe I should back-up and widen the scope before diving into the title question... I'm currently writing a web app in ASP.NET MVC 1.0 (although I do have MVC 2.0 installed on my PC, so I'm not exactly restricted to 1.0) -- I've started with the standard MVC project which has your basic "Welcome to ASP.NET MVC" and shows both the [Home]...

what is the best way to optimize my json on an asp.net-mvc site

i am currently using jqgrid on an asp.net mvc site and we have a pretty slow network (internal application) and it seems to be taking the grid a long time to load (the issue is both network as well as parsing, rendering) I am trying to determine how to minimized what i send over to the client to make it as fast as possible. Here is a ...

ASP.NET MVC User routing like that in StackOverflow ?

I've looked at the routing on StackOverflow and I've got a very noobie question, but something I'd like clarification none the less. I'm looking specifically at the Users controller http://stackoverflow.com/Users http://stackoverflow.com/Users/Login http://stackoverflow.com/Users/124069/rockinthesixstring What I'm noticing is that the...

Extension method not working if I set controller property in Action, works in OnExecuting

I have a class MyController that inherits from Controller, so all my controllers inherit from MyController. I have a property in MyController: public class MyController : Controller { public string SomeProperty {get;set;} } if I set this property in MyController's OnExecuting method, my HtmlHelper extension method works fine: pu...

Using external javascript files with asp.net MVC

I have some javascript inwhich I am using such helpers as var url = <%=ResolveUrl("~/controller/action") %> When the javascript is embeded in the .aspx page using the <script> tag everything works fine When I move it out to an external file those scripts that have the helper methods do not work. Other scripts do just the ones wit...