The following code will give any page the ability to be used as an rss feed automatically

Public class BasePage : System.Web.UI.Page
{
	protected override void Render(HtmlTextWriter writer)
	{
		if (Request.QueryString["rss"] == "true")
		{
			System.Text.StringBuilder sb = new System.Text.StringBuilder();
			System.IO.StringWriter sw = new System.IO.StringWriter(sb);
			HtmlTextWriter nw = new HtmlTextWriter(sw);
			Response.Clear();
			writer.Write("");
			writer.Write("");
			writer.Write(" ");
			writer.Write(" " + this.Request.Url.AbsoluteUri.ToString() + "");
			writer.Write(" ");
			writer.Write(" en-us");
			writer.Write(" " + DateTime.Now.ToUniversalTime().ToString() + "");
			writer.Write(" " + DateTime.Now.ToUniversalTime().ToString() + "");
			writer.Write(" ");
			writer.Write(" Dynamic page generator");
			
			writer.Write(" ");writer.Write(" " + this.Request.Url.AbsoluteUri.ToString() + "");
			writer.Write(" ");
			RenderChildren(nw);
			if (sb.ToString().IndexOf(" ") > 0)
			writer.Write(Util.StripHTML(sb.ToString().Substring(sb.ToString().IndexOf(""))));
			else
			writer.Write(Util.StripHTML(sb.ToString()));
			writer.Write("");
			writer.Write(" " + DateTime.Now.ToUniversalTime().ToString() + "");
			Guid g = new Guid();
			writer.Write(" " + g.ToString() + "");
			writer.Write(" ");writer.Write(" ");
		}
		else
		{
			base.Render(writer);
		}
	}
	
}
	public static class Util
	{
		public static string StripHTML(string htmlString)
		{
			string pattern = @"<(.\n)*?>";
			return Regex.Replace(htmlString.Replace(" ", " "), pattern, string.Empty);
		}
	}

So I tend to use Dotnetnuke alot for my side projects and its just generaly a good portal. But the default solpartmenu was always a creative challange making it look good. And the Asp.net menu provider seems to have a lot of code in it. So i looked around and saw some free menus, but they where always quirky… and when i used reflector on them i could see why. 

Which led to this posting. As you can see my code is always very simple, i hate re inventing the wheel. What this control is doing is populating the menuitemcollection.

using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI.WebControls;
namespace QuickMax.UI
{
public class DnnAspNetMenu : System.Web.UI.WebControls.Menu
{
DotNetNuke.Entities.Modules.PortalModuleBase _DnnBase;
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
_DnnBase = new DotNetNuke.Entities.Modules.PortalModuleBase();
foreach (DotNetNuke.Entities.Tabs.TabInfo tab in _DnnBase.PortalSettings.DesktopTabs)
{
if (tab.IsVisible &amp;&amp; tab.Level == 0)
{
bool badd = false;
foreach (DotNetNuke.Security.Permissions.TabPermissionInfo tbi in tab.TabPermissions)
if (_DnnBase.UserInfo.IsInRole(tbi.RoleName))
badd = true;
if (badd)
{
MenuItem mnuItem = new MenuItem();
mnuItem.Text = tab.TabName;
mnuItem.NavigateUrl = tab.FullUrl;

mnuItem.Selected = tab.TabID.Equals(_DnnBase.PortalSettings.ActiveTab.TabID);FillChildren(ref mnuItem, tab);
this.Items.Add(mnuItem);
}
}
}
}
private void FillChildren(ref MenuItem mnuitem, DotNetNuke.Entities.Tabs.TabInfo parent)
{
foreach (DotNetNuke.Entities.Tabs.TabInfo tab in _DnnBase.PortalSettings.DesktopTabs)
{
if (parent.TabID == tab.ParentId)
{
bool badd = false;
foreach (DotNetNuke.Security.Permissions.TabPermissionInfo tbi in tab.TabPermissions)
if (_DnnBase.UserInfo.IsInRole(tbi.RoleName))
badd = true;
if (badd)
{
MenuItem mnuItem = new MenuItem();
mnuItem.Text = tab.TabName;
mnuItem.NavigateUrl = tab.FullUrl;

mnuItem.Selected = tab.TabID.Equals(_DnnBase.PortalSettings.ActiveTab.TabID);FillChildren(ref mnuItem, tab);
mnuitem.ChildItems.Add(mnuItem);
}
}
}
}
}
}

I was thinking about a couple things….yea i know “max you think?!?!?’

Did you know that the RaisePostDataChanged event is called after all your Load events are called, and this is right before Your postback event is called. This is so that you cant muck up your data on page_load() before it gets to your lets say Textbox.Click event.

Why is this help full to us, well this means that on page load or pre init we can see if the control has changed since its last postback. How?

Well you can still get to the new data from the Request object using the controls ClientID.

You can to this by Request.ServerVariables[Control.ControlID]

so we can create a method like:

public bool hasChanged(TextBox ctr)
{
return Request[Control.ControlID].Equals(ctr.Text);
}

its just the simple and we can subclass any control and do that.
we could also save the original loading value into viewstate.