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

{

get

{

return xds;

}

set

{

xds = value;

}

}

protected override void OnDataBinding(EventArgs e)

{

base.Controls.Clear();

base.OnDataBinding(e);

SiteMapNodeCollection smnc;

xds = this.DataSource;

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

Literal lit = new Literal();

lit.Text = ”

    “;

    base.Controls.Add(lit);

    foreach (SiteMapNode item in smnc)

    {

    lit = new Literal();

    lit.Text = ”

  • “;

    bse.Controls.Add(lit);

    HyperLink lnk = new HyperLink();

    lnk.Text = item.Title;

    lnk.NavigateUrl = item.Url;

    base.Controls.Add(lnk);

    lit = new Literal();

    lit.Text = ”

    “;

    base.Controls.Add(lit);

    }

    lit = new Literal();

    lit.Text = “

“;

base.Controls.Add(lit);

base.Controls.Add(lit);
}
}
}

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!!!!

Links:
Script Callbacks in ASP.NET
http://anthemdotnet.com/
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

to

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.