dedicated to write powerful yet elegant software by using minimum code and maximizing the benefits for all our clients.

Typically, new developers to ASP.Net MVC get stumped with having to deal with one important fact: Page.ResolveUrl(...); is missing!!!

Don't worry or fret - the new way of doing this is:Url.Content(...);

Some sample usage is as below:

Resolving images:

<img src="<%= Url.Content("~/content/images/myImage.gif") %>" alt="My image" title="My image" />

Resolving JavaScript files:

<script language="javascript" type="text\javascript" src="<%= Url.Content("~/scripts/myscript.js") %>"></script>

Simple as that.

When you refer stylesheet files in your *.Master page, this link is directly reference without needing to use the Url helper as shown above.

So, you can continue refering stylesheet files like:

<link rel="stylesheet" type="text\css" media="screen" href="../content/site.css" />

The MVC framework will resolve the path correctly at run-time.

Hmm.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Category: Development | ASP.Net MVC

ASP.Net MVC & jQuery - utopia!!! by Sunny 03/Jun/2009 23:21:00

I finally got the chance to start working on ASP.Net MVC with jQuery & Linq.

My last project was based on the now "old" .Net 2.0  & we went with a complete MS technology stack including their version of AJAX. Adding third party controls to the mix didnot help & only added to the overall complexity of the system. 

MS Ajax - is surely past its sell by date.

When this library was first put out, I was truly excited & hoped it would be all it promised to be. For sometime, I really enjoyed it. But then once I got jQuery-ed, its bye-bye Ms. Ajax. Inspite of all her glitz & glamour, I lost my heart to the pure simplicity of jQuery. 

I have never been a big believer of third party controls - regardless of the claims of the component supporters.

True they save you a load of upfront effort & look cool. Unfortunately, in my experience, the project starts degrading in performance, maintainability & testability the minute a third party control starts appearing in your codebase.

Needless to say, after all that - MVC, jQuery & Linq - utopia!!!

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Category: Development | Tools