<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Rinze Cats' Blog</title><subtitle type="html"> -building accessible websites using everything Asp.Net 2.0 has to offer -</subtitle><id>http://weblogs.asp.net/rinze/atom.aspx</id><link rel="alternate" type="text/html" href="http://weblogs.asp.net/rinze/default.aspx" /><link rel="self" type="application/atom+xml" href="http://weblogs.asp.net/rinze/atom.aspx" /><generator uri="http://communityserver.org" version="3.0.20510.895">Community Server</generator><updated>2008-01-26T11:02:00Z</updated><entry><title>4 little known Asp.Net features</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/rinze/archive/2009/09/06/4-little-known-asp-net-features.aspx" /><id>http://weblogs.asp.net/rinze/archive/2009/09/06/4-little-known-asp-net-features.aspx</id><published>2009-09-06T13:41:58Z</published><updated>2009-09-06T13:41:58Z</updated><content type="html">&lt;p&gt;There’s a really nice article on 4GuysFromRolla, exlaining 4 little know features in .Net that can be really helpfull. Check out &lt;b&gt;&lt;a href="http://www.4guysfromrolla.com/articles/082609-1.aspx"&gt;Four Little Known, Helpful Methods, Properties, and Features for ASP.NET Developers&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7194461" width="1" height="1"&gt;</content><author><name>rinze</name><uri>http://weblogs.asp.net/members/rinze.aspx</uri></author></entry><entry><title>Sorting a Gridview bound to a List</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/rinze/archive/2009/09/06/sorting-a-gridview-bound-to-a-list.aspx" /><id>http://weblogs.asp.net/rinze/archive/2009/09/06/sorting-a-gridview-bound-to-a-list.aspx</id><published>2009-09-06T13:31:00Z</published><updated>2009-09-06T13:31:00Z</updated><content type="html">&lt;p&gt;In pretty much every web application I build, I come across the problem that the default sorting mechanism build in to gridview, doesn’t work when binding to List objects. It requires the gridview to be bound to a dataset object instead of a List. &lt;/p&gt;  &lt;p&gt;While searching the web for a solution, I came across a great post on stackoverflow: &lt;a href="http://stackoverflow.com/questions/617088/sorting-a-gridview-when-databinding-a-collection-or-list-of-objects" mce_href="http://stackoverflow.com/questions/617088/sorting-a-gridview-when-databinding-a-collection-or-list-of-objects"&gt;Sorting a gridview when databinding a collection or list of objects&lt;/a&gt; . The post provides some really nice code, using expression trees, to determine the sort column at runtime. As this code works really nice, I’ll repost it here. I updated it somewhat, cause the original poster didn’t account for the fact the GridViewSortEventArgs object always returns the same sortdirection (SortDirection.Ascending)&lt;/p&gt;  &lt;p&gt;&amp;nbsp;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000ff" size="2"&gt;private void OnGridViewSort(object sender, GridViewSortEventArgs e)      &lt;br&gt;{       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; List&amp;lt;Product&amp;gt; prl = m_Provider.GetAllProducts();       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (prl != null)       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var param = Expression.Parameter(typeof(Product), e.SortExpression);       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var sortExpression = Expression.Lambda&amp;lt;Func&amp;lt;Product, object&amp;gt;&amp;gt;(Expression.Convert(Expression.Property(param, e.SortExpression), typeof(object)), param); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SortDir = (ViewState["SortDirection"] == null) ? SortDir = SortDirection.Ascending : (SortDirection)ViewState["SortDirection"];      &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!string.IsNullOrEmpty(e.SortExpression))       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (e.SortExpression.Equals(this.SortExpression))       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SortDir = (SortDir == SortDirection.Ascending) ? SortDirection.Descending : SortDirection.Ascending;       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ViewState["SortDirection"] = SortDir;       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.SortExpression = e.SortExpression;       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (SortDir == SortDirection.Ascending)       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_GridView.DataSource = prl.AsQueryable&amp;lt;Product&amp;gt;().OrderBy(sortExpression);       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_GridView.DataSource = prl.AsQueryable&amp;lt;Product&amp;gt;().OrderByDescending(sortExpression);       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_GridView.DataBind();       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }       &lt;br&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Hope someone benifits from this!&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Rinze&lt;/font&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7194449" width="1" height="1"&gt;</content><author><name>rinze</name><uri>http://weblogs.asp.net/members/rinze.aspx</uri></author><category term="ASP.NET" scheme="http://weblogs.asp.net/rinze/archive/tags/ASP.NET/default.aspx" /><category term=".Net" scheme="http://weblogs.asp.net/rinze/archive/tags/.Net/default.aspx" /><category term="List" scheme="http://weblogs.asp.net/rinze/archive/tags/List/default.aspx" /><category term="DataBinding" scheme="http://weblogs.asp.net/rinze/archive/tags/DataBinding/default.aspx" /><category term="GridView" scheme="http://weblogs.asp.net/rinze/archive/tags/GridView/default.aspx" /><category term="SortExpression" scheme="http://weblogs.asp.net/rinze/archive/tags/SortExpression/default.aspx" /><category term="SortDirection" scheme="http://weblogs.asp.net/rinze/archive/tags/SortDirection/default.aspx" /></entry><entry><title>Using globalization resources (.resx) in a class library or custom control</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/rinze/archive/2008/12/03/using-globalization-resources-resx-in-a-class-library-or-custom-control.aspx" /><id>http://weblogs.asp.net/rinze/archive/2008/12/03/using-globalization-resources-resx-in-a-class-library-or-custom-control.aspx</id><published>2008-12-03T11:43:00Z</published><updated>2008-12-03T11:43:00Z</updated><content type="html">&lt;p&gt;.Net 2.0 has a nice system for globalization using resource files. For some reason I had never actually used resource files in a class library and as it turned out, it wasn't that easy to find info about this on the web (which surprised me).&lt;/p&gt;&lt;p&gt; In a webapplication project, you can just do something like &lt;/p&gt;&lt;p&gt;Resources.MyApp.Helloworld&lt;/p&gt;&lt;p&gt;To access the resource string Helloworld in the MyApp.resx file. This however, doesn't work in a class library, so I implemented globalization in my webcontrol using the following code:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Resources.ResourceManager man = new System.Resources.ResourceManager("MyNameSpace.App", Assembly.GetExecutingAssembly());&lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string helloworld = string.Empty;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (man != null)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; helloworld = man.GetString("Helloworld", Thread.CurrentThread.CurrentUICulture);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&lt;/p&gt;&lt;p&gt;As it turns out, there is a much simpler way to do it, which is described in the blogpost: &lt;a href="http://blog.mediawhole.com/2007/05/localizing-web-parts-custom-controls.html" title="http://blog.mediawhole.com/2007/05/localizing-web-parts-custom-controls.html" target="_blank" mce_href="http://blog.mediawhole.com/2007/05/localizing-web-parts-custom-controls.html"&gt;Localizing Web Parts, Custom Controls, and Class Libraries.&lt;/a&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;You can just do: myapp.Helloworld. That's it. You do have to make sure your class and the resx file are in the same namespace (or reference is by namespace of course). "MyApp" in this case is the class name of the resource file (you can look it up in the designer.cs created along with the .resx). &lt;/p&gt;&lt;p&gt;Cheers,&lt;/p&gt;&lt;p&gt;Rinze &lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6763854" width="1" height="1"&gt;</content><author><name>rinze</name><uri>http://weblogs.asp.net/members/rinze.aspx</uri></author><category term=".Net" scheme="http://weblogs.asp.net/rinze/archive/tags/.Net/default.aspx" /><category term="Resources" scheme="http://weblogs.asp.net/rinze/archive/tags/Resources/default.aspx" /><category term="Custom Controls" scheme="http://weblogs.asp.net/rinze/archive/tags/Custom+Controls/default.aspx" /><category term=".resx" scheme="http://weblogs.asp.net/rinze/archive/tags/.resx/default.aspx" /><category term="Globalization" scheme="http://weblogs.asp.net/rinze/archive/tags/Globalization/default.aspx" /><category term="Class library" scheme="http://weblogs.asp.net/rinze/archive/tags/Class+library/default.aspx" /></entry><entry><title>Lua Three Column Layout Live example.</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/rinze/archive/2008/11/10/lua-three-column-layout-live-example.aspx" /><id>http://weblogs.asp.net/rinze/archive/2008/11/10/lua-three-column-layout-live-example.aspx</id><published>2008-11-10T14:39:00Z</published><updated>2008-11-10T14:39:00Z</updated><content type="html">&lt;p&gt;Hi,&lt;/p&gt;&lt;p&gt;I posted a &lt;a href="http://weblogs.asp.net/rinze/archive/2008/10/07/lua-3-column-layout-accessible-seo-optimised-and-cross-browser-compatible.aspx" title="http://weblogs.asp.net/rinze/archive/2008/10/07/lua-3-column-layout-accessible-seo-optimised-and-cross-browser-compatible.aspx" mce_href="http://weblogs.asp.net/rinze/archive/2008/10/07/lua-3-column-layout-accessible-seo-optimised-and-cross-browser-compatible.aspx"&gt;Visual Studio 2008 project&lt;/a&gt; with (nested) masterpage examples and a Flexible Cross Browser 3 Column layout earlier on this blog. &lt;br&gt;&lt;/p&gt;&lt;p&gt;I have now put up a live sample, you can find it at &lt;a href="http://lualayout.bissadvice.nl/" title="LuaLayout three column example" target="_blank" mce_href="http://lualayout.bissadvice.nl/"&gt;lualayout.bissadvice.nl&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Cheers,&lt;/p&gt;&lt;p&gt;rinze &lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6728422" width="1" height="1"&gt;</content><author><name>rinze</name><uri>http://weblogs.asp.net/members/rinze.aspx</uri></author><category term="MasterPages" scheme="http://weblogs.asp.net/rinze/archive/tags/MasterPages/default.aspx" /><category term=".Net" scheme="http://weblogs.asp.net/rinze/archive/tags/.Net/default.aspx" /><category term="3 column  layout" scheme="http://weblogs.asp.net/rinze/archive/tags/3+column++layout/default.aspx" /><category term="Lua" scheme="http://weblogs.asp.net/rinze/archive/tags/Lua/default.aspx" /><category term="Css" scheme="http://weblogs.asp.net/rinze/archive/tags/Css/default.aspx" /></entry><entry><title>Server.MapPath is playing tricks on me</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/rinze/archive/2008/10/16/server-mappath-is-playing-tricks-on-me.aspx" /><id>http://weblogs.asp.net/rinze/archive/2008/10/16/server-mappath-is-playing-tricks-on-me.aspx</id><published>2008-10-16T14:23:00Z</published><updated>2008-10-16T14:23:00Z</updated><content type="html">&lt;p&gt;Hi,&lt;/p&gt;&lt;p&gt;I just ran into some really weird behaviour in Server.MapPath. I am running an Asp.Net 3.5 project on my Vista machine (Dutch OS). My solution resides in my personal folder, which actually is triggering the behaviour. &lt;br&gt;&lt;br&gt;I'm trying to load an xml document from my file system using Server.Mappath, which keeps returning null, eventhough the file is there. In debug mode I noticed that the path returned by Server.Mappath is the english language path to your personal folder instead of the dutch path! (c:\&lt;b&gt;users&lt;/b&gt;\rinze\&lt;b&gt;documents&lt;/b&gt;\.... is returned, but on my system this is actually called c:\&lt;b&gt;gebruikers&lt;/b&gt;\rinze\&lt;b&gt;documenten&lt;/b&gt;\)&amp;nbsp; &lt;/p&gt;&lt;p&gt;Weird huh? &lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6682961" width="1" height="1"&gt;</content><author><name>rinze</name><uri>http://weblogs.asp.net/members/rinze.aspx</uri></author><category term="ASP.NET" scheme="http://weblogs.asp.net/rinze/archive/tags/ASP.NET/default.aspx" /><category term="Server.MapPath" scheme="http://weblogs.asp.net/rinze/archive/tags/Server.MapPath/default.aspx" /><category term="3.5" scheme="http://weblogs.asp.net/rinze/archive/tags/3.5/default.aspx" /></entry><entry><title>Visual Studio 2008 Designer is buggy as hell?</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/rinze/archive/2008/10/15/visual-studio-2008-designer-is-buggy-as-hell.aspx" /><id>http://weblogs.asp.net/rinze/archive/2008/10/15/visual-studio-2008-designer-is-buggy-as-hell.aspx</id><published>2008-10-15T07:41:00Z</published><updated>2008-10-15T07:41:00Z</updated><content type="html">&lt;p&gt;&lt;b&gt;Update 18:23: Oh boy, Did I make a booboo!&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;You can disregard everything posted below. I made a stupid mistake and am very much ashamed. My .aspx, including the page directive below was missing the actual &amp;lt;%@ &lt;i&gt;Page&lt;/i&gt;&lt;/b&gt;&amp;nbsp; &lt;b&gt;%&amp;gt;&lt;/b&gt; &lt;b&gt;statement. Well, maybe this helps somebody overlooking the same thing, but I am truly sorry for wasting your time :-)&lt;/b&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;With Visual Studio 2008, the trouble with the nested masterpages not displaying in the IDE has been resolved, but it looks like we're not out of the woods yet. I don't really use the designer, but I today I wanted to check if nested masterpages really are supported, which apparently was like opening pandora's box. &lt;/p&gt;&lt;p&gt;I am running into two problems for which cannot find a fix anywhere on the web.&lt;/p&gt;&lt;p&gt;First off: &lt;b&gt;The designer works great for masterpages&lt;/b&gt;. Opening a masterpage or nested masterpage in the Visual Studio 2008 designer works like a charm. Trouble start when you want to create pages based on these masterpages (who would want to do that?).&amp;nbsp; &lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Problem 1: Custom declarative properties break the designer entirely&lt;/b&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;I am used to working with a common basepage for all my .aspx files, to add not only common functionality, but also common properties to set for each page. I use these properties declaritively, like so:&lt;br&gt;&lt;br&gt;&amp;lt;%@ &lt;br&gt;&amp;nbsp;&amp;nbsp; Language = "C#" &lt;br&gt;&amp;nbsp;&amp;nbsp; MasterPageFile = "~/includes/masterpages/Product.master"&lt;br&gt;&amp;nbsp;&amp;nbsp; Inherits = "LuaLayout.Common.BasePage"&lt;br&gt;&amp;nbsp;&amp;nbsp; EnableSessionState = "False"&lt;br&gt;&amp;nbsp;&amp;nbsp; EnableViewState = "False"&lt;br&gt;&amp;nbsp;&amp;nbsp; Title = "Lua 3 Column Layout"&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;b&gt;Keywords &lt;/b&gt;= "Lua, Rocks, !"&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;b&gt;MetaDescription &lt;/b&gt;= "This layout was created by Rinze Cats"&lt;br&gt;%&amp;gt;&lt;br&gt;&lt;br&gt;Both keywords and metadescription are public properties defined in Common.BasePage. They work, but get the red underlining you really don't want to see. This I can most certainly live with. &lt;b&gt;However, this completely disables design mode. &lt;/b&gt;It's just gives you an error that there's a problem with some controls on your page. &lt;br&gt;&lt;br&gt;&lt;b&gt;Problem 2:&lt;br&gt;&lt;/b&gt;This one is really getting to me. The designer appears to cache certain page settings which it will not release, not even when restarting the entire development environment. For example, changing the masterpage in the above MasterPageFile Directive does not change anything in the designer. It simply does not get updated. It's driving me completely mad. Because of this, I cannot test any further.&lt;br&gt;&lt;/p&gt;&lt;p&gt;Has anybody experienced these problems? I think the first one just might not be supported (which would be very disappointing), the second one looks like a serious bug to me, but all I know is that it's not working. Any help/fixes are greatly appreciated. My VS 2008 build is:&amp;nbsp; 9.0.30729.1 SP. I have looked into the 'Path' problem you read about when searching for designer issues on google, but this is not fixing anything for me.&amp;nbsp; &lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6681983" width="1" height="1"&gt;</content><author><name>rinze</name><uri>http://weblogs.asp.net/members/rinze.aspx</uri></author><category term=".Net" scheme="http://weblogs.asp.net/rinze/archive/tags/.Net/default.aspx" /><category term="Visual Studio 2008" scheme="http://weblogs.asp.net/rinze/archive/tags/Visual+Studio+2008/default.aspx" /><category term="Designer" scheme="http://weblogs.asp.net/rinze/archive/tags/Designer/default.aspx" /><category term="Bug" scheme="http://weblogs.asp.net/rinze/archive/tags/Bug/default.aspx" /><category term="Visual Studio" scheme="http://weblogs.asp.net/rinze/archive/tags/Visual+Studio/default.aspx" /></entry><entry><title>3 Column Layout (Lua) update</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/rinze/archive/2008/10/14/3-column-layout-lua-update.aspx" /><link rel="enclosure" type="application/octet-stream" length="211294" href="http://weblogs.asp.net/rinze/attachment/6680971.ashx" /><id>http://weblogs.asp.net/rinze/archive/2008/10/14/3-column-layout-lua-update.aspx</id><published>2008-10-14T15:33:00Z</published><updated>2008-10-14T15:33:00Z</updated><content type="html">&lt;p&gt;As described in an update to my previous post: safari is now supported. I added a static version of the layout, just the html and css as an attachment to this post.&lt;/p&gt;&lt;p&gt;Cheers,&amp;nbsp;&lt;/p&gt;&lt;p&gt;Rinze &lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6680971" width="1" height="1"&gt;</content><author><name>rinze</name><uri>http://weblogs.asp.net/members/rinze.aspx</uri></author><category term="SEO" scheme="http://weblogs.asp.net/rinze/archive/tags/SEO/default.aspx" /><category term="Liquid Layout" scheme="http://weblogs.asp.net/rinze/archive/tags/Liquid+Layout/default.aspx" /><category term="3 Column Layout" scheme="http://weblogs.asp.net/rinze/archive/tags/3+Column+Layout/default.aspx" /><category term="Height 100%" scheme="http://weblogs.asp.net/rinze/archive/tags/Height+100_2500_/default.aspx" /></entry><entry><title>Lua: 3 Column Layout, Accessible, SEO optimised and Cross Browser Compatible</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/rinze/archive/2008/10/07/lua-3-column-layout-accessible-seo-optimised-and-cross-browser-compatible.aspx" /><link rel="enclosure" type="application/octet-stream" length="89484" href="http://weblogs.asp.net/rinze/attachment/6663481.ashx" /><id>http://weblogs.asp.net/rinze/archive/2008/10/07/lua-3-column-layout-accessible-seo-optimised-and-cross-browser-compatible.aspx</id><published>2008-10-07T19:44:00Z</published><updated>2008-10-07T19:44:00Z</updated><content type="html">&lt;p&gt;&lt;b&gt;Update 14-10-2008: I updated the liquid layout stylesheet. It is now simpler and works fine in safari as well. I added an attachment (LuaLayoutStatic.zip) containing three html examples and the stylesheets and updated the original template in this post. The static one can be found in an additional post, cause only one attachment can be added unfortunately....&lt;br&gt;&lt;/b&gt;&lt;br&gt;&lt;br&gt;Creating a XHTML tableless layout can be a very tedious and difficult task. There are a number of templates and css generators out there, like &lt;a href="http://www.positioniseverything.net/articles/pie-maker/pagemaker_2_9_home.html" title="cleava treva" mce_href="http://www.positioniseverything.net/articles/pie-maker/pagemaker_2_9_home.html"&gt;clevatreva's piefecta layout&lt;/a&gt;, but none we're exactly to my liking. During the projects I have worked on the past couple of years I've developed and improved upon a 3 column layout that takes into account alot of common elements you'd want in such a layout. Loads of developers are struggling to get their layouts right and are being destracted from the actual task at hand. A couple of days ago I got triggered to do something about it. &lt;br&gt;&lt;br&gt;I have a created (let's call it version 1) of a flexible 3 column layout. The layout uses a minimal number of css hacks, absolute positioned elements (i like it better without) and works in most common browsers. At the time of writing, the layout is working to my liking in Opera, Firefox, and IE5+. I'll test it on the Mac (firefox and safari) this week Futhermore, it's SEO optimised, by which I mean that the most important page elements (&lt;b&gt;the content&lt;/b&gt;) are placed first in the source order, then the content related container, then the navigational elements. &lt;br&gt;&lt;br&gt;&lt;/p&gt;Some additional features of the layout (which I have called &lt;b&gt;Lua&lt;/b&gt;, by the way)&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;Spreads to the bottom of the page, regardsless of the amount of content. The footer is always positioned to the bottom of the page.&lt;/li&gt;
&lt;li&gt;Relative measures: All elements are sized in relation to the body font size, meaning that upon increasing/decreasing the font (in your browser menu, in your body css or using your scroll wheel) all elements will scale accordingly.&lt;/li&gt;
&lt;li&gt;A tabbed css only menu example (based on suckerfish). The flyout menu also includes an alpha transparent border example when hovered. For IE this behaviour is activated using a htc file (which I got from &lt;a href="http://www.positioniseverything.net" mce_href="http://www.positioniseverything.net"&gt;positioniseverything&lt;/a&gt;.)&lt;/li&gt;
&lt;li&gt;An optional shadowborder to create an 'hovering effect' for your panel on the background&lt;/li&gt;
&lt;li&gt;A contrast stylesheet setting all elements to a black and white version for accessibility purposes&lt;/li&gt;
&lt;li&gt;Full height column to enable backgrounds for sidebars&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;The layout can be used as panel (a restricted-width container) or as a Liquid layout, spreading the contentarea to whatever space is available. It is designed to spread to the full height of the page and has been created using Firefox 3. Whereever necessary adjustments for IE browser versions are included using conditional IE includes. These are not supported by .Net's theme feature, the main reason I am not making this available as a theme.&amp;nbsp; &lt;br&gt;Liquid behaviour is disabled by default, but can simply be enabled by adding an extra css file (commented in the source).&lt;br&gt;&lt;br&gt;I offer the entire package as a download. I created a Visual Studio 2008 template for it, to get you going quickly. This template also includes some .Net features I've grown accustomed to, like adding the ability to include an extra stylesheet in a Masterpage or Nested Masterpage using Masterpage and .aspx basepage properties. Examples are readily available in the template. I added some rendered html output examples as well, displaying the flexibility added by including certain stylesheets in the main masterpage. To use these html examples, simply place them in the root.&lt;br&gt;&lt;/p&gt;
&lt;p&gt;As a finale note: I have written a few exceptions for IE5 and IE5.5 that are specific for the liquid layout. You might want to disable those if you're not using it. Also, there are some css alternatives I have written and added as comments in the css.&lt;br&gt;&lt;/p&gt;
&lt;p&gt;Let me know what you think and please report bugs :-)&lt;br&gt;&lt;br&gt;Hope this helps,&lt;/p&gt;
&lt;p&gt;Rinze &lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6663481" width="1" height="1"&gt;</content><author><name>rinze</name><uri>http://weblogs.asp.net/members/rinze.aspx</uri></author><category term="Nested MasterPages" scheme="http://weblogs.asp.net/rinze/archive/tags/Nested+MasterPages/default.aspx" /><category term="MasterPages" scheme="http://weblogs.asp.net/rinze/archive/tags/MasterPages/default.aspx" /><category term="ASP.NET" scheme="http://weblogs.asp.net/rinze/archive/tags/ASP.NET/default.aspx" /><category term="C#" scheme="http://weblogs.asp.net/rinze/archive/tags/C_2300_/default.aspx" /><category term=".Net" scheme="http://weblogs.asp.net/rinze/archive/tags/.Net/default.aspx" /><category term="Accessibility" scheme="http://weblogs.asp.net/rinze/archive/tags/Accessibility/default.aspx" /><category term="Cross Browser" scheme="http://weblogs.asp.net/rinze/archive/tags/Cross+Browser/default.aspx" /><category term="SEO" scheme="http://weblogs.asp.net/rinze/archive/tags/SEO/default.aspx" /><category term="3 column  layout" scheme="http://weblogs.asp.net/rinze/archive/tags/3+column++layout/default.aspx" /><category term="XHTML Strict" scheme="http://weblogs.asp.net/rinze/archive/tags/XHTML+Strict/default.aspx" /><category term="Tableless" scheme="http://weblogs.asp.net/rinze/archive/tags/Tableless/default.aspx" /></entry><entry><title>Remove .Net styles from page header </title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/rinze/archive/2008/10/04/remove-net-styles-from-page-header.aspx" /><id>http://weblogs.asp.net/rinze/archive/2008/10/04/remove-net-styles-from-page-header.aspx</id><published>2008-10-04T12:20:00Z</published><updated>2008-10-04T12:20:00Z</updated><content type="html">&lt;P mce_keep="true"&gt;For quite some&amp;nbsp;time now, I've been working on websites aiming for WCAG 2.0 compliance and 'clean' html output. Using .Net 2.0 this can be quit a challenge, since the .Net control output is anything but WCAG compliant and clean. Something had to be done to change the default .Net behaviour if we wanted to accomplish this compliance level, while benifiting as much as possible from the .Net controls collection. Over time, we have adopted some great techniques to get things done, which I will be sharing in this and upcoming blogposts (using masterpages, control adapters, javascript injecten, .browser files, custom html textwriters etc.).&lt;BR&gt;&lt;BR&gt;But first i'll explain how to get rid of the annoying stylesection that .Net navigation controls add to your page header. Working on a site's navigational structure, we noticed that .Net was doing this, and we couldn't get rid of it! Since we want all styling&amp;nbsp;to reside in external css files, this was really annoying us. &lt;STRONG&gt;There was NO WAY to fix this using control adapters&lt;/STRONG&gt;. Below is an example.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;lt;style type="text/css"&amp;gt;&lt;BR&gt;&amp;nbsp;.ctl00_ctl00_LeftSidebarWirePlaceholder_LeftSidebarNavigationPlaceholder_TreeView1_0 { text-decoration:none; }&lt;BR&gt;&amp;nbsp;.ctl00_ctl00_PageHeadingNavigationPlaceholder_headernav_0 { background-color:white;visibility:hidden;display:none;position:absolute;left:0px;top:0px; }&lt;BR&gt;&amp;nbsp;.ctl00_ctl00_PageHeadingNavigationPlaceholder_headernav_1 { text-decoration:none; }&lt;BR&gt;&amp;nbsp;.ctl00_ctl00_PageHeadingNavigationPlaceholder_headernav_2 {&amp;nbsp; }&lt;BR&gt;&amp;lt;/style&amp;gt;&lt;BR&gt;&lt;BR&gt;After an endless search we discovered a neat little feature in the .browser file. Using the capabilities section,&amp;nbsp;one can disable this behaviour. &lt;BR&gt;&amp;lt;capabilities&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;&amp;lt;capability name="supportsCss" &amp;nbsp;value="false" /&amp;gt;&lt;/STRONG&gt;&lt;BR&gt;&amp;lt;/capabilities&amp;gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;Hope someone will benifit from this! &lt;BR&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6657533" width="1" height="1"&gt;</content><author><name>rinze</name><uri>http://weblogs.asp.net/members/rinze.aspx</uri></author><category term=".Net" scheme="http://weblogs.asp.net/rinze/archive/tags/.Net/default.aspx" /><category term="Control Adapters" scheme="http://weblogs.asp.net/rinze/archive/tags/Control+Adapters/default.aspx" /><category term="treeview" scheme="http://weblogs.asp.net/rinze/archive/tags/treeview/default.aspx" /><category term=".browser file" scheme="http://weblogs.asp.net/rinze/archive/tags/.browser+file/default.aspx" /><category term="navigation controls" scheme="http://weblogs.asp.net/rinze/archive/tags/navigation+controls/default.aspx" /><category term="menu" scheme="http://weblogs.asp.net/rinze/archive/tags/menu/default.aspx" /><category term="header" scheme="http://weblogs.asp.net/rinze/archive/tags/header/default.aspx" /><category term="style" scheme="http://weblogs.asp.net/rinze/archive/tags/style/default.aspx" /></entry><entry><title>System.Runtime.InteropServices.COMException while converting to VS 2008</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/rinze/archive/2008/09/25/system-runtime-interopservices-comexception-while-converting-to-vs-2008.aspx" /><id>http://weblogs.asp.net/rinze/archive/2008/09/25/system-runtime-interopservices-comexception-while-converting-to-vs-2008.aspx</id><published>2008-09-25T21:40:00Z</published><updated>2008-09-25T21:40:00Z</updated><content type="html">&lt;P mce_keep="true"&gt;Hi there,&lt;/P&gt;
&lt;P mce_keep="true"&gt;today I converted my .Net 2.0 Visual Studio 2005 Web Application Project to Visual studio 2008 and .Net 3.5. I&amp;nbsp;also moved it to a different machine.&amp;nbsp;I ran into an error while converting some of the projects in my solution, preventing the entire project to load. I found a &lt;A class="" href="http://aspadvice.com/blogs/robertb/archive/2008/05/07/System.Runtime.InteropServices.COMException-in-WAP-VS-2008-Project.aspx" target=_blank mce_href="http://aspadvice.com/blogs/robertb/archive/2008/05/07/System.Runtime.InteropServices.COMException-in-WAP-VS-2008-Project.aspx"&gt;blogpost&lt;/A&gt; describing the error as being caused by a reference to IIS.&lt;BR&gt;&lt;BR&gt;You can simply overcome this by opening your project's configuration file (.csproj) and changing the &amp;lt;UseIIS&amp;gt;True&amp;lt;/UseIIS&amp;gt; node to false. This way the project will load and you will be able reconfigure wherever necesary&lt;/P&gt;
&lt;P mce_keep="true"&gt;Hope this helps!&lt;BR&gt;Rinze&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6641893" width="1" height="1"&gt;</content><author><name>rinze</name><uri>http://weblogs.asp.net/members/rinze.aspx</uri></author><category term="ASP.NET" scheme="http://weblogs.asp.net/rinze/archive/tags/ASP.NET/default.aspx" /><category term="Visual Studio 2008" scheme="http://weblogs.asp.net/rinze/archive/tags/Visual+Studio+2008/default.aspx" /><category term="Web Application Project" scheme="http://weblogs.asp.net/rinze/archive/tags/Web+Application+Project/default.aspx" /><category term="Conversion" scheme="http://weblogs.asp.net/rinze/archive/tags/Conversion/default.aspx" /></entry><entry><title>Custom SitemapProvider with multiple sitemap files</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/rinze/archive/2008/02/07/custom-sitemapprovider-with-multiple-sitemap-files.aspx" /><id>http://weblogs.asp.net/rinze/archive/2008/02/07/custom-sitemapprovider-with-multiple-sitemap-files.aspx</id><published>2008-02-07T17:48:00Z</published><updated>2008-02-07T17:48:00Z</updated><content type="html">&lt;P mce_keep="true"&gt;Hi, today I ran into a problem using Multiple sitemap files in combination with a custom sitemapprovider inheriting from the XmlSiteMapProvider class. Since&amp;nbsp;I couldn't find a solution&amp;nbsp;to this on the web, I thought i'd share my findings ;-)&lt;/P&gt;
&lt;P mce_keep="true"&gt;When using multiple sitemap files, you can either add a sitemapnode to your .sitemap indicating a provider for this node, or you can add a sitemapnode pointing to a different .sitemap. &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;&amp;lt;siteMapNode provider="myProvider" /&amp;gt; or&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;&amp;lt;siteMapNode siteMapFile="morenav.sitemap" /&amp;gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P mce_keep="true"&gt;Problem with the first solution is that you have to explicitly point to a provider in your web.config and thus add a provider for each sitemapfile.&amp;nbsp;This creates an unwanted dependency, especially (as is the case in my situation) when the additional sitemapfile is created by someone else (a different project team for example). More importantly, you just can't go around adding providers for each external sitemapfile. It works though! &lt;BR&gt;&lt;BR&gt;Problem with the second solution&amp;nbsp;is that you can't get it to work with your custom Sitemap provider. Let's say we&amp;nbsp;configure the default sitemapprovider to use&amp;nbsp;a custom provider, say MySitemapProvider. When using multiple sitemap files, you'll find the custom provider is used for your main sitemap, but not for your referenced sitemap. &lt;/P&gt;
&lt;P mce_keep="true"&gt;It took me a while to figure it out, but this is what you might call a bug in Asp.Net 2.0. It took a deep dive into reflector and some major frustration&amp;nbsp;to figure it out, but the .Net framework explicitly uses the standard XmlSiteMapProvider whenever you apply the siteMapFile attribute on one of your nodes. Since these methods are private and use sealed system.web classes I couldn't find a way to program around this. If anybody has thoughts on this, feel free to share!&lt;BR&gt;&lt;BR&gt;Oh, and another thing: the provider attribute always take precendence. You would think you could define a siteMapFile on your node and a provider to make it more generic, but you can't!&lt;BR&gt;&lt;BR&gt;Hope this saves someone the trouble.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Cheers,&lt;BR&gt;rinze&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=5731789" width="1" height="1"&gt;</content><author><name>rinze</name><uri>http://weblogs.asp.net/members/rinze.aspx</uri></author><category term="Sitemap" scheme="http://weblogs.asp.net/rinze/archive/tags/Sitemap/default.aspx" /><category term="ASP.NET" scheme="http://weblogs.asp.net/rinze/archive/tags/ASP.NET/default.aspx" /><category term=".Net" scheme="http://weblogs.asp.net/rinze/archive/tags/.Net/default.aspx" /><category term="Multiple Sitemaps" scheme="http://weblogs.asp.net/rinze/archive/tags/Multiple+Sitemaps/default.aspx" /><category term="Custom Sitemap Provider" scheme="http://weblogs.asp.net/rinze/archive/tags/Custom+Sitemap+Provider/default.aspx" /></entry><entry><title>Creating Accessible (WCAG) Asp.Net 2.0 Websites</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/rinze/archive/2008/01/27/accessible-asp-net-2-0-websites-beyond-css-friendly-control-adapters.aspx" /><id>http://weblogs.asp.net/rinze/archive/2008/01/27/accessible-asp-net-2-0-websites-beyond-css-friendly-control-adapters.aspx</id><published>2008-01-27T12:01:00Z</published><updated>2008-01-27T12:01:00Z</updated><content type="html">&lt;P mce_keep="true"&gt;By Now, anybody involved with building accessible websites in .Net 2.0 will have come across the CSS Frienly Control Adapter toolkit. For those of you who haven't, have a look at the &lt;A class="" title="Css friendly control adapter toolkit" href="http://www.codeplex.com/cssfriendly" target=_blank mce_href="http://www.codeplex.com/cssfriendly"&gt;codeplex cssfriendly project&lt;/A&gt;. Orginally released by Microsoft, but currently maintained by the community.&lt;BR&gt;&lt;BR&gt;I'll be doing a series of posts on the subject of building accessible websites using the control adapters, the control adapter toolkit&amp;nbsp;and other techniques, cause there is alot more to it then what is currently being addressed by the adapters in the toolkit. WCAG Guidelines stretch alot further then not using tables to create a page layout. Futhermore, the toolkit itself is&amp;nbsp;far from complete: there are a number of .Net controls that render&amp;nbsp;non-compliant output, which are very difficult to adapt in a correct way&amp;nbsp;(login control, linkbutton, gridview&amp;nbsp;etc.).&lt;BR&gt;&lt;BR&gt;In this first post I'll be giving an overview of some of the issues I encountered with the control adapters, the control adapter toolkit in specific and accessibility in Asp.Net websites in general. In the following post, I'll provide solution and techniques for all these issues. Furthermore, I will share my experience in adopting these techniques to&amp;nbsp;create&amp;nbsp;Xhtml&amp;nbsp;compliant websites using MOSS 2007. &lt;BR&gt;&lt;BR&gt;&lt;STRONG&gt;What control adapters should be doing&lt;/STRONG&gt;&lt;BR&gt;The first thing I noticed when I started working with the toolkit, was the abundance of class names throughtout the adapters. Using css to style your site is one thing, but adding all these class names is another. A good example of this is the menu adapter:&amp;nbsp;all that really needs to be marked is the selected menu&amp;nbsp;item, nothing else. But it marks almost every node!&lt;BR&gt;&lt;BR&gt;&lt;STRONG&gt;Removing classnames alltogether by using overloaded controls&lt;BR&gt;&lt;/STRONG&gt;Since Xhtml compliance and WCAG are very much general purpose, I'd like to seperate the adaptation of erronous .Net control behaviour and adding classes to add corporate identity to the output.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Adding control adapters for .Net controls&lt;BR&gt;&lt;/STRONG&gt;Adding adapters for a various controls can be quite troublesome. We'll give it a go anyways.&lt;BR&gt;&lt;BR&gt;&lt;STRONG&gt;Remove Inline styling from your page header&lt;BR&gt;&lt;/STRONG&gt;The Inline style added to the page header should be removed. It adds nothing and goes against proper website building principles!&lt;BR&gt;&lt;BR&gt;&lt;STRONG&gt;Place javascript in your header&lt;BR&gt;&lt;/STRONG&gt;Script tags should be well-formed and placed inside the page header, nowhere else. .Net has a tendency to place them throughout your page!&amp;nbsp;&lt;BR&gt;&lt;BR&gt;&lt;STRONG&gt;Take Control of&amp;nbsp;of the rendered output&amp;nbsp;using&amp;nbsp;a&amp;nbsp;XhtmlTextWriter, Modules and HttpFilters&lt;/STRONG&gt;&lt;BR&gt;Using various techniques involving httpfilters, page adapters en xhtmltextwriters, alot can be accomplished in an elegant way.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Adhere to some basic accessibility rules!&lt;BR&gt;&lt;/STRONG&gt;Some general stuff to consider.&lt;BR&gt;&lt;BR&gt;&lt;STRONG&gt;Creating accessible websites using&amp;nbsp;Sharepoint / MOSS 2007&amp;nbsp;&lt;/STRONG&gt;&lt;BR&gt;I'll go through the basics and apply beforementioned techniques to properly generate Xhtml compliant websites using MOSS 2007.&lt;BR&gt;&lt;BR&gt;I'll follow up on this soon!&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=5658935" width="1" height="1"&gt;</content><author><name>rinze</name><uri>http://weblogs.asp.net/members/rinze.aspx</uri></author><category term="ASP.NET" scheme="http://weblogs.asp.net/rinze/archive/tags/ASP.NET/default.aspx" /><category term="C#" scheme="http://weblogs.asp.net/rinze/archive/tags/C_2300_/default.aspx" /><category term=".Net" scheme="http://weblogs.asp.net/rinze/archive/tags/.Net/default.aspx" /><category term="CSS Friendly" scheme="http://weblogs.asp.net/rinze/archive/tags/CSS+Friendly/default.aspx" /><category term="HttpFilters" scheme="http://weblogs.asp.net/rinze/archive/tags/HttpFilters/default.aspx" /><category term="Control Adapters" scheme="http://weblogs.asp.net/rinze/archive/tags/Control+Adapters/default.aspx" /><category term="WCAG" scheme="http://weblogs.asp.net/rinze/archive/tags/WCAG/default.aspx" /><category term="Accessibility" scheme="http://weblogs.asp.net/rinze/archive/tags/Accessibility/default.aspx" /><category term="MOSS" scheme="http://weblogs.asp.net/rinze/archive/tags/MOSS/default.aspx" /><category term="Sharepoint Accessibility kit" scheme="http://weblogs.asp.net/rinze/archive/tags/Sharepoint+Accessibility+kit/default.aspx" /></entry><entry><title>Using custom expression builders</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/rinze/archive/2008/01/26/using-custom-expression-builders.aspx" /><id>http://weblogs.asp.net/rinze/archive/2008/01/26/using-custom-expression-builders.aspx</id><published>2008-01-26T10:02:00Z</published><updated>2008-01-26T10:02:00Z</updated><content type="html">&lt;P mce_keep="true"&gt;Hi all,&lt;/P&gt;
&lt;P mce_keep="true"&gt;For my first blogpost I would like to give some attention to a very nice - but not so widely known - feature in Asp.Net 2.0 called "Custom Expression Builders". There is a new expression type in 2.0 that looks like this: "&amp;lt;%$ %&amp;gt;". U can use it to load values from your AppSettings, but it gets more fun when you start using it to dynamically load resources in statements like this:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;lt;asp:Literal runat="server" Text="&amp;lt;%$ CustomResource, SomeValue %&amp;gt;" /&amp;gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;It allows you to dynamically set values on your controls. There's loads of fun stuff you can do with that. I have thankfully adopted this mechanism to avoid the use of FindControl. You often run into a situation where you will have to perform a FindControl in the Onload event of your webform, to apply some settings to a control on your page. Although FindControl usually gets the job done, I've never been a big fan of it. You create a depency on the Control's ID and things start falling apart when switching to masterpages and nested control inside your placeholders. And then there's code readabilty: you are changing the behaviour or attributes of some control in your masterpage or page, where it would be much nicer to let the control figure it out for itself. &lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;An example of how you can use Custom Expression Builders:&lt;/STRONG&gt;&lt;BR&gt;I have been working on a website that allows the user to navigate back to an overview page from a more detailed page. I use a sitemap for all my navigation, and I want to retrieve the Url from my SiteMap Provider. There are loads of ways to do this, an obvious one would be to write a custom control and setting the values in the custom control's life cyle events. I don't like writing custom controls for everything, so I gave it a go with Custom Expressions. &lt;/P&gt;
&lt;P mce_keep="true"&gt;In my masterpage I have the following hyperlink control (using the .Net 2.0 navigation controls is a but much for a single link):&lt;BR&gt;&amp;lt;asp:HyperLink runat="server" TabIndex="7" rel="nofollow" ID="overviewlink"&lt;BR&gt;&amp;nbsp;ToolTip="&amp;lt;%$ Resources: Control, ReturnLinkTooltip&amp;nbsp; %&amp;gt;" &lt;BR&gt;&amp;nbsp;NavigateUrl="&amp;lt;%$ DynamicUrl: PreviousNavigationLevel %&amp;gt;"&lt;BR&gt;&amp;nbsp;Text="&amp;lt;%$ Resources: Control, ReturnLinkText&amp;nbsp; %&amp;gt;" /&amp;gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;Now, the custom expression type is used in the NavigateUrl="&amp;lt;%$ DynamicUrl: ShrinkFont %&amp;gt;" statements. The tooltip and text just get their values from a regular resource file to ensure there is no content hard coded in my masterpage and to globalise the link. Then I create a custom expression builder class, like so:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &amp;lt;summary&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// Provide Dynamic Urls for Fixed Page Hyperlinks&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public class UrlExpression : System.Web.Compilation.ExpressionBuilder&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #region Private properties&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private static UriBuilder m_Pageuri;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #endregion&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #region Public static properties&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &amp;lt;summary&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// Returns the pageUri&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static UriBuilder Pageuri&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Uri url = HttpContext.Current.Request.Url;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_Pageuri = new UriBuilder(url.Scheme, url.Host, url.Port, url.AbsolutePath);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (ArgumentOutOfRangeException ex)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Diagnostics.Trace.WriteLine(string.Format("Error constructing the uri: {0}", ex.Message));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception ex)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Diagnostics.Trace.WriteLine(string.Format("Error formatting the url: {0}", ex.Message));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return m_Pageuri; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #endregion&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #region Overriden System.Web.Compilation.ExpressionBuilder members&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// The GetCodeExpression returns the expression to be evaluated when the Page parser finds a declarative expression and calls the required ExpressionBuilder. &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public override CodeExpression GetCodeExpression(BoundPropertyEntry entry, object parsedData, ExpressionBuilderContext context)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CodeTypeReferenceExpression thisType = new CodeTypeReferenceExpression(base.GetType());&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CodePrimitiveExpression expression = new CodePrimitiveExpression(entry.Expression.Trim().ToString());&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string evaluationMethod = "GetUrlValue";&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return new CodeMethodInvokeExpression(thisType, evaluationMethod, new CodeExpression[] { expression });&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #endregion&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #region Public methods&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Retrieves the requested url value&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static string GetUrlValue(string expression)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string returnvalue = string.Empty;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UriBuilder returnUri = new UriBuilder(Pageuri.Uri);&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; switch (expression)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case "PreviousNavigationLevel":&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string sitemapPath = string.Empty;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// get the default sitemap provider&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SiteMapProvider Provider = SiteMap.Provider;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (Provider != null)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // My custom sitemapprovider always sets the currentnode to the same sitemap level&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SiteMapNode Current = Provider.CurrentNode;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (Current != null)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sitemapPath = Current.Url;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (NullReferenceException e)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // health monitoring&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sitemapPath = string.Empty;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!string.IsNullOrEmpty(sitemapPath))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; returnUri.Path = sitemapPath;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; default:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Do Nothing&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; returnvalue = returnUri.Uri.PathAndQuery;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!string.IsNullOrEmpty(returnvalue))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return returnvalue;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return string.Empty;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #endregion&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P mce_keep="true"&gt;Based on the expression requested, it returns the appropriate url. &lt;/P&gt;
&lt;P mce_keep="true"&gt;There's one last thing you have to do, because your application doesn't know about this custom resource you created. In the &amp;lt;compilation /&amp;gt; section of your web.config add the following configuration:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;expressionBuilders&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add expressionPrefix="DynamicUrl" type="Rinze.Utility.UrlExpression"/&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/expressionBuilders&lt;/P&gt;
&lt;P mce_keep="true"&gt;By calling the DynamicUrl resource from my webpages and adding case statements to my UrlExpression class, I can now easily expand and provide all dynamic url's without using anythign other than hyperlinks.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Hope this helps!&lt;/P&gt;
&lt;P mce_keep="true"&gt;Rinze&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=5655270" width="1" height="1"&gt;</content><author><name>rinze</name><uri>http://weblogs.asp.net/members/rinze.aspx</uri></author><category term="Sitemap" scheme="http://weblogs.asp.net/rinze/archive/tags/Sitemap/default.aspx" /><category term="MasterPages" scheme="http://weblogs.asp.net/rinze/archive/tags/MasterPages/default.aspx" /><category term="FindControl" scheme="http://weblogs.asp.net/rinze/archive/tags/FindControl/default.aspx" /><category term="ASP.NET" scheme="http://weblogs.asp.net/rinze/archive/tags/ASP.NET/default.aspx" /><category term="Custom Expression Builders" scheme="http://weblogs.asp.net/rinze/archive/tags/Custom+Expression+Builders/default.aspx" /><category term="Sitemap Providers" scheme="http://weblogs.asp.net/rinze/archive/tags/Sitemap+Providers/default.aspx" /><category term="C#" scheme="http://weblogs.asp.net/rinze/archive/tags/C_2300_/default.aspx" /><category term=".Net" scheme="http://weblogs.asp.net/rinze/archive/tags/.Net/default.aspx" /></entry></feed>