Click here to Skip to main content
15,886,199 members
Articles / Web Development / ASP.NET

AMenu - A Simple .NET Vertical Menu

Rate me:
Please Sign up or sign in to vote.
4.88/5 (26 votes)
8 Oct 2009CPOL4 min read 64K   3.1K   100  
A CSS based .NET vertical menu control.
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


namespace mtweb
{

/////////////////////////////////////////////////////////////////////

public partial class DControl : System.Web.UI.UserControl
{
  // Fields
  protected HistoryEventArgs m_hea = null;
  protected ParameterCollection m_pc = null;


  // Static ctor
  public static T LoadUC<T>(string file, Page p) where T : DControl
  {
    T dc = (T)p.LoadControl(file);
    dc.ID = Path.GetFileName(file).Replace('.', '_');
    dc.UCPage = file;
    return dc;
  }


  ///////////////////////////////////////////////
  // Properties

  public string UCPage
  {
    set {
      if (string.IsNullOrEmpty(value)) return;
      ViewState["UCPage"] = value;
    }
    get {
      string s = ViewState["UCPage"] as string;
      if (string.IsNullOrEmpty(s)) return null;
      return s;
    }
  }


  public ParameterCollection Params
  {
    get {
      string s = ViewState["Params"] as string;
      if (string.IsNullOrEmpty(s)) return null;
      return Util.DeserializePC(s);
    }

    set {
      if (value == null) ViewState.Remove("Params");
      else {
        m_pc = value;
        ViewState["Params"] = Util.SerializePC(value);
      }
    }
  }


  public HistoryEventArgs UCHistoryArgs
  {
    set { m_hea = value; }
    get { return m_hea; }
  }


  ///////////////////////////////////////////////
  // Methods

  public DControl LoadContent(string file, HistoryEventArgs e)
  {
    return null;
  }

  public DControl ReloadContent()
  {
    return null;
  }


}  // class
}  // namespace

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Europe Europe
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions