Click here to Skip to main content
11,481,404 members (61,073 online)
Click here to Skip to main content

Combo Control

, 24 Jan 2005 196.4K 2.6K 124
Rate this:
Please Sign up or sign in to vote.
4-in-1 component for ASP.NET DHTML tab, tree, panel, menu - horizontal, vertical, pop-up, fading effects
Sample screenshot

Introduction

This is a control that will help to generate Tabs, Menus, Slider Bars and Tree Views. The controls are created "Just in Time" dynamically from XML.

Background

We see many web pages with lots of controls. Most of the controls available in the market are quiet expensive and they do only one job (i.e. if it is a menu control, we can't use it for tab). This control has all the built-in features, including security. For example, the user may want some of the items in the tab to be visible to a particular set of users, say administrators, and some less important to the common users. In that case, this plays an important role.

This control is very easy to use. The control exposes some public properties to set the data, the look 'n' feel and the events for the panel. By setting these properties, the collapsible panel can be used to group information very nicely.

Using the Code

The user control has six public properties:

  • Controltype - To mention the type of control (tab, tree, panel, menu)
  • Display - To set alignment of the control (only to Controltype = menu)
  • PageTitle - To set the page title (only to Controltype = tab)
  • MainMenuSelected - To set the Main menu (only to Controltype = tab)
  • SubMenuSelected - To set the Submenu selected (only to Controltype = tab)
  • ImageUrl - To set the Image in the tree (only to Controltype = tree).
<%@ Register TagPrefix="CONTROL" Namespace="Controls" Assembly="FOURINONE"%>
 
// for tab
<CONTROL:FourinOne runat="server" 
  PageTitle="Congress Type" Controltype="tab"
  MainMenuSelected="2" SubMenuSelected="1" />
 
// for tree
<CONTROL:FourinOne runat="server" Controltype="tree" />
 
// for panel bar
<CONTROL:FourinOne runat="server" Controltype="panel" />
 
// for menu - horizontal
<CONTROL:FourinOne runat="server" Controltype="menu" Display="h" />
 
// for menu - vertical
<CONTROL:FourinOne runat="server" Controltype="menu" Display="v" />

For generating the menu, tree, panel or tab dynamically, the XML should be of the form:

<Menu>
  <MainMenu Label="Registration" BaseURL="SearchCongress.aspx" MenuID="8"
    MainSecurity="AM" MenuSequence="1" ImageUrl="xp_documents.gif">
    <SubMenu Label="Search" URL="SearchCongress.aspx" MenuID="8"
      Security="AM" SubMenuID="9" SubMenuSequence="1" 
      ImageUrl="xp_documents.gif"/>
    <SubMenu Label="Add Company" URL="CompanyDetails.aspx" MenuID="8"  
      Security="A" SubMenuID="6" SubMenuSequence="4" 
      ImageUrl="xp_documents.gif"/>
    <SubMenu Label="New Order" URL="NewOrder.aspx" MenuID="8" Security="AM" 
      SubMenuID="7" SubMenuSequence="5" ImageUrl="xp_documents.gif"/>
  </MainMenu>
  <MainMenu Label="Maintenance" BaseURL="Congress.aspx" MenuID="6" 
    MainSecurity="A" MenuSequence="4" ImageUrl="xp_documents.gif">
    <SubMenu Label="Congress Type" URL="Congress.aspx" 
      MenuID="6" Security="A" SubMenuID="1" 
      SubMenuSequence="1" ImageUrl="xp_documents.gif"/>
    <SubMenu Label="Event Type" URL="EventType.aspx" MenuID="6" Security="A" 
      SubMenuID="2" SubMenuSequence="2" ImageUrl="xp_documents.gif"/>
    <SubMenu Label="Sales Type" URL="SalesType.aspx" MenuID="6" Security="A" 
      SubMenuID="3" SubMenuSequence="3" ImageUrl="xp_documents.gif"/>
    <SubMenu Label="Venue" URL="CongressVenue.aspx" MenuID="6" Security="A" 
      SubMenuID="4" SubMenuSequence="4" ImageUrl="xp_documents.gif"/>
    <SubMenu Label="Office" URL="Office.aspx" MenuID="6" Security="A" 
      SubMenuID="6" SubMenuSequence="6" ImageUrl="xp_documents.gif"/>
    <SubMenu Label="Sales Person" URL="SalesPerson.aspx" 
      MenuID="6" Security="A" SubMenuID="7" SubMenuSequence="7" 
      ImageUrl="xp_documents.gif"/>
    <SubMenu Label="Tax Rate" URL="TaxRate.aspx" MenuID="6" Security="A" 
      SubMenuID="8" SubMenuSequence="8" ImageUrl="xp_documents.gif"/>
    <SubMenu Label="User" URL="User.aspx" Security="A" MenuID="6" 
      SubMenuID="9" SubMenuSequence="9" ImageUrl="xp_documents.gif"/>
    <SubMenu Label="Option Type" MenuID="6" URL="PriceOption.aspx" 
      Security="A" SubMenuID="10" SubMenuSequence="10" 
      ImageUrl="xp_documents.gif"/>
  </MainMenu>
</Menu>

The MainSecurity attribute in the MainMenu node and the Security attribute in the SubMenu node are used to implement the security in displaying the menu items. To implement security in this control, keep the UserType in the session, for example (A for administrator), when the user logs on to the system. By comparing the value in session, the security is implemented.

private bool isAuthorised(string sSecString, string sSecType)
{
  return(sSecString.IndexOf(sSecType)>=0);
}

The isAuthorized method returns true if the user is authorized to view that page, else it returns 0. For exmple, I have taken two users, Administrator (A) and Moderator (M). I have mentioned the pages that can be viewed only by the administrator as A and pages that can be viewed by both of them as AM. The menu can be configured using web.config.

      <add key="MenuXMLPath" value="/helper/" />
      <add key="MainMenuFontColor" value="#ffffff" />
      <add key="MainMenuShadowColor" value="#999999" />
      <add key="MainMenubGColor" value="#000088" />
      <add key="MainMenuMouseoverColor" value="#000088" />
      <add key="SubmenuBgColor" value="#cfd3d8" />
      <add key="SubmenuMouseoverColor" value="#ffffff" />
      <add key="SubmenuBorderColor" value="#0000cc" />
      <add key="SubmenuFontColor" value="#000000" />
      <add key="SubmenuMouseOverFontColor" value="#000000" />
      <add key="SubmenuShadowColor" value="#666666" />

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Venkat Eswaran
Web Developer TCS
India India
No Biography provided

Comments and Discussions

 
QuestionI like your control. Pin
Member 448042417-Mar-12 19:15
memberMember 448042417-Mar-12 19:15 
GeneralFor Tab Controls Pin
PradeepPuru23-Jul-07 22:03
memberPradeepPuru23-Jul-07 22:03 
QuestionDon't know how to install... too bad! Pin
ahuitt29-Aug-06 5:55
memberahuitt29-Aug-06 5:55 
GeneralDon't know what to do Pin
bolivar_roger10-May-06 14:27
memberbolivar_roger10-May-06 14:27 
GeneralThank you so much Pin
ch9280126-Mar-06 11:06
memberch9280126-Mar-06 11:06 
GeneralUnable to use this control Pin
Hafeezi17-Dec-05 2:28
memberHafeezi17-Dec-05 2:28 
AnswerRe: Unable to use this control Pin
BAHNIN29-Dec-05 1:11
memberBAHNIN29-Dec-05 1:11 
Questionhow can i use this control to show context menu on right click for each item of datagrid Pin
Max_amin27-Oct-05 4:36
memberMax_amin27-Oct-05 4:36 
QuestionWho can help me? Pin
djdada5-Sep-05 0:07
memberdjdada5-Sep-05 0:07 
AnswerRe: Who can help me? Pin
enjoycrack5-Sep-05 1:23
memberenjoycrack5-Sep-05 1:23 
GeneralRe: Who can help me? Pin
djdada5-Sep-05 2:02
memberdjdada5-Sep-05 2:02 
GeneralRe: Who can help me? Pin
enjoycrack5-Sep-05 2:39
memberenjoycrack5-Sep-05 2:39 
GeneralRe: Who can help me? Pin
Anonymous5-Sep-05 4:05
sussAnonymous5-Sep-05 4:05 
GeneralRe: Who can help me? Pin
enjoycrack5-Sep-05 21:00
memberenjoycrack5-Sep-05 21:00 
GeneralObject reference not set to an instance of an object. Pin
nSerj2-Sep-05 2:30
membernSerj2-Sep-05 2:30 
GeneralTool tip Pin
prateek pagey31-Aug-05 20:55
memberprateek pagey31-Aug-05 20:55 
QuestionHow can I to locate the menu horizontal or vertical on the page? Pin
lobox23-Aug-05 2:08
susslobox23-Aug-05 2:08 
GeneralInstall Pin
Luis Guillermo2-Aug-05 11:15
sussLuis Guillermo2-Aug-05 11:15 
QuestionHow to disable menu transparency Pin
zbandit20@yahoo.com27-Jul-05 12:47
memberzbandit20@yahoo.com27-Jul-05 12:47 
Questionhow to use this control in my existings appn Pin
liju_p_k@rediffmail.com27-Jul-05 5:34
memberliju_p_k@rediffmail.com27-Jul-05 5:34 
QuestionThree level menu FOURINONE.dll? Pin
Adeel Ahmed Abassi16-Jun-05 21:48
memberAdeel Ahmed Abassi16-Jun-05 21:48 
GeneralFacing Problem in using FOURINONE.dll and control Pin
Adeel Ahmed Abassi15-Jun-05 19:59
memberAdeel Ahmed Abassi15-Jun-05 19:59 
GeneralRe: Facing Problem in using FOURINONE.dll and control Pin
Venkat Eswaran16-Jun-05 2:34
memberVenkat Eswaran16-Jun-05 2:34 
GeneralRe: Facing Problem in using FOURINONE.dll and control Pin
Adeel Ahmed Abassi16-Jun-05 19:57
memberAdeel Ahmed Abassi16-Jun-05 19:57 
GeneralThanks for your efforts Pin
dbvaughan6-Jun-05 17:23
memberdbvaughan6-Jun-05 17:23 
Generaltree control in mozilla Pin
hickhead007-Apr-05 3:45
memberhickhead007-Apr-05 3:45 
Generalinstall tutorial Pin
hickhead0024-Mar-05 6:44
memberhickhead0024-Mar-05 6:44 
GeneralRe: install tutorial Pin
hickhead0024-Mar-05 7:28
memberhickhead0024-Mar-05 7:28 
GeneralAdjusting height of H menu Pin
jole121-Mar-05 20:44
memberjole121-Mar-05 20:44 
QuestionHow can I add this control to my project Pin
simurg21-Mar-05 2:09
susssimurg21-Mar-05 2:09 
AnswerRe: How can I add this control to my project Pin
albatros41521-Mar-05 2:33
memberalbatros41521-Mar-05 2:33 
GeneralTab Control problem Pin
Imhoteph20-Mar-05 11:05
sussImhoteph20-Mar-05 11:05 
GeneralChange target Pin
albatros41519-Mar-05 1:10
memberalbatros41519-Mar-05 1:10 
GeneralRe: Change target Pin
rw20020-Mar-05 13:22
memberrw20020-Mar-05 13:22 
GeneralObject reference not set to an instance of an object. Pin
albatros41518-Mar-05 5:18
memberalbatros41518-Mar-05 5:18 
GeneralRe: Object reference not set to an instance of an object. Pin
albatros41518-Mar-05 5:26
memberalbatros41518-Mar-05 5:26 
GeneralRe: Object reference not set to an instance of an object. Pin
albatros41518-Mar-05 5:28
memberalbatros41518-Mar-05 5:28 
GeneralFrame support Pin
rw2008-Mar-05 13:17
memberrw2008-Mar-05 13:17 
QuestionForms in sub directories? Pin
richtrapp4-Mar-05 13:58
memberrichtrapp4-Mar-05 13:58 
AnswerRe: Forms in sub directories? Pin
rw2007-Mar-05 18:41
memberrw2007-Mar-05 18:41 
GeneralQuestions Pin
rw2001-Mar-05 12:36
memberrw2001-Mar-05 12:36 
GeneralRe: Questions Pin
rw2001-Mar-05 12:39
memberrw2001-Mar-05 12:39 
GeneralRe: Questions Pin
Venkat Eswaran1-Mar-05 18:04
memberVenkat Eswaran1-Mar-05 18:04 
GeneralRe: Questions Pin
rw2002-Mar-05 13:31
memberrw2002-Mar-05 13:31 
General3 levels is now possible Pin
Venkat Eswaran28-Feb-05 4:29
memberVenkat Eswaran28-Feb-05 4:29 
GeneralRe: 3 levels is now possible Pin
richtrapp3-Mar-05 12:53
memberrichtrapp3-Mar-05 12:53 
GeneralRe: 3 levels is now possible Pin
natesuda11-Apr-05 1:59
membernatesuda11-Apr-05 1:59 
GeneralRe: 3 levels is now possible Pin
Guillermo Mejía22-Aug-05 14:28
memberGuillermo Mejía22-Aug-05 14:28 
GeneralSubMenu color Pin
waveout10-Feb-05 20:42
memberwaveout10-Feb-05 20:42 
GeneralRe: SubMenu color Pin
Venkat Eswaran11-Feb-05 16:07
memberVenkat Eswaran11-Feb-05 16:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150520.1 | Last Updated 24 Jan 2005
Article Copyright 2004 by Venkat Eswaran
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid