IF OBJECT_ID (N'dbo.MenuMain', N'U') IS NOT NULL DROP TABLE dbo.MenuMain; GO CREATE TABLE dbo.MenuMain(ID INT, [Name] VARCHAR(50),[Link] VARCHAR(50), [Title] VARCHAR(50), ParentID INT, [Order] INT) INSERT INTO dbo.MenuMain SELECT 1, 'CSS Drop Down Menus', NULL, NULL, 0, 1 UNION ALL SELECT 2, 'Vertical CSS Pop-Out Menu', NULL, NULL, 0, 2 UNION ALL SELECT 3, 'CSS Hover Navigation', '#', 'SEO Consultants Directory', 2, 1 UNION ALL SELECT 4, 'Horizontal Drop & Pop Menu', NULL, NULL, 0, 3 UNION ALL SELECT 5, 'SEO Consultants Sample', '#', 'SEO Consultants Vertical Example', 2, 2 UNION ALL SELECT 6, 'Tanfa Demo example', '#', 'Complete Example', 5, 1 UNION ALL SELECT 7, 'Stage 1', '#', 'Vertical Menu - Page 1', 6, 1 UNION ALL SELECT 8, 'Stage 2', '#', 'Vertical Menu - Page 2', 6, 2 UNION ALL SELECT 9, 'Stage 3', '#', 'Vertical Menu - Page 3', 6, 3 UNION ALL SELECT 10, 'Stage 4', '#', 'Vertical Menu - Page 4', 6, 4 UNION ALL SELECT 11, 'Stage 5', '#', 'Vertical Menu - Page 5', 6, 5 SELECT ID , [Name], [Link], [Title], CASE WHEN ParentID = 0 THEN NULL ELSE ParentID END AS ParentID, [Order] FROM dbo.MenuMain ORDER BY ParentID, [Order]
using System; using System.Data; using System.Configuration; using System.Collections; 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; using System.Data.SqlClient; using System.Text; public partial class HorizontalCssMenu : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //http://ago.tanfa.co.uk/css/examples/menu/tutorial-h.html#hs7 //http://www.alistapart.com/articles/horizdropdowns/ if (!IsPostBack) { LoadMenu(); } } private void LoadMenu() { DataTable dtMenu = LoadData(); StringBuilder sbMenu = new StringBuilder(); foreach (DataRow dr in dtMenu.Rows) { if (string.IsNullOrEmpty(Convert.ToString(dr["ParentID"])) || Convert.ToString(dr["ParentID"]) == "0") { if (sbMenu.Length != 0) sbMenu.Append(Environment.NewLine); sbMenu.Append("
- " + Environment.NewLine); sbMenu.Append("
- ");
sbMenu.Append("" + Convert.ToString(dr["Name"]) + "
" + Environment.NewLine);
sbMenu.Append("
" + Environment.NewLine + "
- "); sbTemp.Append(Environment.NewLine + "
- ");
sbTemp.Append("" + Convert.ToString(dr["Name"]) + "");
sbTemp.Append(Environment.NewLine + "
"); if (Convert.ToInt32(dr["Order"]) == 1) sbTemp.Append(Environment.NewLine + "
Download .cs, .aspx, .css, .sql file form below
HorizontalCssMenu.zip
References
ago.tanfa.co.uk
Example
alistapart
1 comment:
HorizontalCssMenu.zip File is not available to download anymore. Can you please fix it.
Post a Comment