I didn’t post any css in my previous post for the use of the menu control this is the css i used when i was creating it. The Menu Id is a horizontal menu and Nav Id is a vertical menu, as you can see all i have to do is assign the CssId to the control and we manage the look with css and the content in code.

My next post will be about using the Roles to determine access to the user.

Sample CSS:

/**** Main Menu ***/

#menu {
display: block;

#menu ul {
margin: 0;
list-style: none;

#menu li {
display: block;
float: left;
white-space: nowrap;

#menu li a {
display: block;
padding: 55px 20px 12px 20px;
text-decoration: none;
color: #fff;
font-weight: bold;

* html #menu a {width:1%;}

#menu li a:hover {
background: url(../img/bg_menu.gif);

#menu li a.current {
letter-spacing: 1px;
color: gray;
background: url(../img/bg_menu.gif);

#menu li a.current:hover {
color: #fff;

/**** nav ***/
#nav{ list-style: none; margin: 2.0em 0; width: 25em; float: right;}
#nav li{ padding: 0; margin: 0; }
#nav a{
display: block;
height: 2.0em;
padding: 0.3em 0.3em 0.3em 0.8em;
border-bottom: 2px; /*solid #1a1a1a*/
border-top: 2px; /*solid #1a1a1a*/
color: #93B300;
background-color: #F7F9FB;
font-weight: bold;
text-decoration: none;

#nav a:hover{
color: #1a1a1a;
background: url(../img/bg_t.gif) no-repeat;
background-color: #fff;
font-weight: bold;

As you can see from the code bellow it is very easy to create a Server Control that takes in a SiteMapDataSource. Simply get a SiteMapNodeCollection  from the provider and iterate through it and build your html.

This way you can create controls to fit your design and still have all the ability to manage your site from the xml file. Also you are able to get all the roles and user accessibility for each node.

Source Code:

using System;

using System.Data;

using System.Configuration;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

namespace Yournamespace.UI.WebControls


/// Summary description for MenuTop


[ Serializable()]

public class MenuSiteMap : Panel


private SiteMapDataSource xds;

public SiteMapDataSource DataSource




return xds;




xds = value;



protected override void OnDataBinding(EventArgs e)




SiteMapNodeCollection smnc;

xds = this.DataSource;

smnc = xds.Provider.GetChildNodes( xds.Provider.RootNode);

Literal lit = new Literal();

lit.Text = ”



    foreach (SiteMapNode item in smnc)


    lit = new Literal();

    lit.Text = ”

  • “;


    HyperLink lnk = new HyperLink();

    lnk.Text = item.Title;

    lnk.NavigateUrl = item.Url;


    lit = new Literal();

    lit.Text = ”




    lit = new Literal();

    lit.Text = “




What happend to the Client ScriptCallback feature of Asp.Net 2.0, Well nothing really happened to Asp.Net 2.0’s client call back…its there and MS Ajax.net (aka atlas) actually uses this in the back end. The reason why we don’t here about it is…it is a paint in the you know what! To actually get anything done….but there was less of a foot print on the page.

Right now we have a couple API’s for writing Ajax is asp.net:

  1. MS Ajax.Net (aka Atlas)
  2. Anthem.Net
  3. Ajax.Net or Professional Ajax.Net

Out of all three Ajax.net has a smaller foot print on the page. The other two still simulate the full page life cycle using XmlHttpRequest and pushing most of the data back. Which means that most of the application written in using Ajax.net or writhing the actual javascript your self will be faster than using an API with all the over head.

What MS Ajax.net and Anthem do offer is that they are easy to use, and you do not have to dig into the specific and writing javascript. Just throw things in a UpdatePanel or AnthemPanel and all your post backs get translated to callbacks. This is still better than a full post because your screen doesn’t flicker…. but lets not get to the point that everything is done through XmlHttpRequest and we basically have gone back to the old problem.

Tips when not to Use Ajax… because the list of when to use it is actually longer…

  1. To hide objects don’t do a full callback just use javascript to set its style display to none, why do a full call back if all your doing is hiding something.
  2. If a callback is going to Redirect a user when it get back to the client, just do a post and redirect him or her from there because it gets annoying. If it has to go all the way to server just do a post and redirect or do a Server.transfer.
  3. Don’t do a call back if it take 30 sec to return, but if you must give the user a message so he or she knows your processing data.

Small pet-peeve of mine are all there API’s that say they are an Ajax library and there purely javascript….. YOU’RE A JAVASCRIPT API LIVE WITH IT!!!!

Script Callbacks in ASP.NET
MS ajax
Professional Ajax.net

So continuing with the BI theme lets take a look a small example.
Sample Code: http://quick-max.com/samples/BI/BI-Lite.zip

So i was thinking how much SQL would I have to write to actually get this to work
at the smallest level. The answer if one simple view that gave me Primary Key, and foreign key mappings that i called PkFk (go figure). The rest of the data retrieval was handled by Subsonic package, why write a whole data layer when all that i am interested in is Table names and keys.

The code only really has two files that you want to take a look at default.aspx.cs and TblGraphItem.cs. Also you will need to run the create view sql script on the pubs database….but you can basically point it to any database and change the code slightly.

so what were my results, very simple use reporting tool with some drill down. Where i didn’t have to write table specific code.

Examples: ( ‘->’ will be used to signify drill down)

1. Titles -> Sale


so you can see that I output what sections drill down to what data. I have over simplified the notion of BI but this is the basis, the difference is all you need is the View and its plug and play from there on… i don’t have to massage my data to accommodate reporting.

In researching for B.I tools to be used at work, that could suite our needs I quickly found out a miss conception….there isn’t a plug and play reporting tool. SQL Reporting services, Endeca analytics, cognus ….all require a lot of work to setup.

Now lets say i want to create a small and very simple reporting tool with drill downs. What would i have to know to get the base up.

Base list

  1. List of all tables
  2. All relationships between table
  3. If relationships could be marked as graph it would be useful to know top level parents…and the Nth level children.

So if we construct a database with all Primary and Foreign keys set correctly, steps 1 & 2 we can extract from the database catalog.

Part 3 should be taken care of when we start putting entires into the graph.

So a couple of buddies of mine showed me a little nifty application called SubSonic. Its A lite and dare i say cute ORM ( Object relation mapper). The reason i like it is because it has low footprint in the project. And i dont have to do any funky configuration to get it to work.

To run the sample you will need One of the Visual studio 2005 flavors…either express or standard and above will due. You will also require SQL Expression or some other SQL Server editions…like 2000 or 2005.

Sample Code: http://quick-max.com/samples/QBlog.net.zip

  1. Run ASPnet_REGSQL.exe and point to the database you want to work with.
  2. Then run locate the BlogTables.SQL and run it against your Prefered Database
  3. Open Up project folder as a website.
  4. Edit your mainCon connection string to point to your database.

Now we are ready to work. The Subsonic.dll has been included in project for you.
You will notice in the app_code directory that there is a builder.adp file. This file is used by subsonic to specify what table you want it to create Objects for. You may specify all table by
putting a ( * ) as the only entry in the file, or specify a table name per line.

Lets compile the project so that Subsonic builds our objects for us. Once you compile then the objects will show up.

You will notice a couple object where created, three of them being QuickMaxBlog, QuickMaxBlogEntry, and QuickMaxBlogEntryComment.

This is basically all we need to save postings to the database.
So lets take a look at Blog.CS

So i took the little nifty RSS Xml writter from Daniel Bright at CodeProject, I just added a couple blog specific functions.

So as you can see from the code sample above, i did not have to write a snippet of sql to get this to work. So the actually time you have developing time decreases. Its almost like mash up programming. I know I know i’m over simplifying it because this those not have any real business rules ……So lets say hypothetically I wanted to add more functionality to the base object created by subsonic…..well theres a little nifty feature in .Net 2.0 called….PARTIAL CLASSES….WHoooo Hooo…. and so all you have to do is create a partical class and you can inject any method, variable or properties that you might want to use…….

….well i hope you guys check this out its pretty nifty….

Subsonic : http://www.codeplex.com/actionpack
Daniel Bright: http://www.codeproject.com/aspnet/RSSviaXmlTextWriter.asp
Sample Code: http://quick-max.com/samples/QBlog.net.zip