Tuesday, October 6, 2009

Adding Dynamic Menus from a Database

Fetch the Records from database which has Page Name and URL,


MenuItem mnuItem;
for (int intRwcnt = 0; intRwcnt < dtMenu.Rows.Count; intRwcnt++)
{
mnuItem = new MenuItem(dtMenu.Rows[intRwcnt]["PageName"].ToString(), dtMenu.Rows[intRwcnt]["PageName"].ToString(), "", dtMenu.Rows[intRwcnt]["PageUrl"].ToString());
mnuCommon.Items.Add(mnuItem);
}

No comments:

Post a Comment