asp.net-mvc

Running a js function after ajax call puts incoming data to an element

I have an ajax link in my application: <head> <script type="text/javascript">function GoFurther() { ... }</script> </head> ... <%= Ajax.ActionLink("Go", "SomeAction", "SomeController", new AjaxOptions() { UpdateTargetId = "someDiv" }) %> <div id="someDiv"></div> I want to execute GoFurther() after ajax request completes AND someDiv is...

ProcessRequest(HttpContextBase) method.

How to change the default Action name inside the ProcessRequest(HttpContextBase) method.. ...

Generating client-side validation from LLBLGen validation

I've been looking and it seems no-one has cracked this yet but I thought I'd ask the community here as well to see if anything came up. Is there a way to get client-side validation (jQuery, Live Validation, whatever) to automagically get the validation rules from LLBLGen's built in validation? LLBLGen (and others like Subsonic) alread...

ASP.NET MVC Default Parameters

I have created a new route like the following: routes.MapRoute( "BlogYMD", "blog/date/{year}/{month}/{day}", new { controller = "Blog", action = "Date", year = "2009", month="01", day="01" }); The view simply returns a concatenation of year, month and day. This works fine for URL's like: http://localhost/blog/date/2...

Are Try Catches still useful?

When I first started programming in .NET I used try/catches all the time. I am finding lately though I rarely ever use them for web applications. My exception (no pun intentended) is unmanaged code that could potentially create a memory leak such as com objects. Are they really needed anymore or do they just clutter things up? UPDATE: ...

How do I display selected value in a cascading drop down list?

I want extension of the following code for selected value in edit view. take a case of country -> state -> city. i have script CascadingDropDownList.js: function bindDropDownList(e, targetDropDownList) { var key = this.value; var allOptions = targetDropDownList.allOptions; var option; var newOption; targetDropDownL...

How to Generate a Link to download a File in asp.net MVC?

Hi, I am testing Doddle Report to generate a few report form a IEnumerable object. I need to generate a Link like this PDF - http://myserver.com/reports/ProductsReport.pdf The Question is how do I do this? En Stop Using Doddle Report, and generate del Excel in XML format. ...

JQuery using Json to call Controller/Action

I have a search page where the top of the page is search criteria with a search button. The bottom of the screen is the results from when the search button is pressed. In this case I have 6 different search criteria the user can input. I would like to bundle all the criteria into one class so my Controller action can read the Json ...

'The application relative virtual path '~/' is not allowed here' in unit test on 2K3 build server but not XP/Vista dev machines

I'm mocking out HttpRequestBase so I can create an HtmlHelper in test code and write tests around HtmlHelper extension methods. I do this as part of the setup code: httpRequestBase.Stub(h => h.ApplicationPath).Return("~/"); httpRequestBase.Stub(h => h.AppRelativeCurrentExecutionFilePath).Return(appPath); httpRequestBase.Stub(h => h.Path...

Do I have to pre-compile asp.net mvc apps?

In WebForms we can leave the compilation until the first request in IIS. It is then compiled and requests are served. In ASP.NET MVC can I do the same thing, or do I have to pre-compile the app? ...

asp mvc Ajax.BeginForm return View or value, confused on return types.

If the the user is not using javascript, I will refresh the view with a RedirectToAction after an IsAjaxRequest check. This works when I have a user contrl in the page and return partial view. BUt when I just want to return a value, say int, and also still want to use RedirectToAction when not an ajax request, how do i set up the metho...

ASP.NET MVC, jQuery/AJAX cascading dropdownlist issues with LINQ2SQL??

Hi guys, The premise: Get a dropdownlist's content based on the value selected in the first one. Literal data returns successfully. LINQ queries on a LINQ2SQL Datacontext fail. Being a total rookie at this MVC/LINQ/jQuery stuff, I battled for HOURS on end trying to figure out what was wrong w/ my understanding of the code. When i hard...

I have 15 minutes to present ASP.NET MVC to my colleagues. What topics should I focus on?

I've been using ASP.NET MVC for personal projects since before it hit RTM. I am preparing a presentation for my colleagues to introduce them to basic concepts of ASP.NET MVC and show them how it could be used in our environment. My presentation has a 15 minute limit. There is a lot of information to relay (especially if you factor in p...

Is there a way to change existing project type from ASP.NET Web Application to ASP.NET MVC Application in VS 2008?

So Visual Studio offers MVC content in context menus for "Add View", etc... Sure, i can create a new MVC Web Application project type and move the files from the non-MVC one there, but is there a way to change the project type without doing that step? ...

How to get the Json object for drop down?

Hi, after trying much more on cascading drop down I decided to do it by Jquery. This is in my cityController public ActionResult States(int id) { AcademicERP.Models.AcademicERPDataContext dc = new AcademicERPDataContext(); var states = from s in dc.States where s.CountryID == id ...

Override Authorize Attribute in ASP.NET MVC

I have an MVC controller base class on which I applied the Authorize attribute since I want almost all of the controllers (and their actions along) to be authorized. However I need to have a controller and an action of another controller unauthorized. I wanted to be able to decorate them with the [Authorize(false)] or something but thi...

Json object access

Hi, I am using $.getJSON(url,data,callback) method. and from url it returns a JSON object of list type (e.g. states.ToList()) so how can i read that object? states.ToList will have records of ID, and Name, and I want to bind it with select tag (for selection list at client page. ...

Populate 2 or more tables in ASP MVC

Hello, in new in ASP MVC im reading some examples and looking on internet, i think its not so hard once you jump into it. im a webform programmer but i want to use MVC for internet applications and Webforms for Intranet Apps. im looking the way of populate more than 1 table in MVC, because the method only allow me to return One ModelVi...

Relationships with ASP.NET MVC

I usually use the Ruby on Rails framework but for this project I need to work with ASP.NET MVC and I'm confused. Basically I have 1 table : *Page = (id, name, category_id)* Category_id is actually a link to a page (a page can be linked to another page). I set up foreign keys and everything, the model is up and working. My question is...

How can I implement Dynamic Routing with my choice of URL format?

My URL requirement is countryname/statename/cityname. For this I'm writing my own RouteHandler and adding one new route into the routecollection like this: routes.Add(new Route("{*data}", new RouteValueDictionary(new { controller = "Location", action = "GetLocations" ...