|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
Announcements
Want a new Job?
Chapters
Services
Feature Zones
|
IntroductionThis article will show a nice & simple cool Web control for drill down menu with diverse client side behaviors and functionality and it will also show some few nice and handy options on the server side. The next section explains a little bit the urge for this kind of UI components and also raises a few points regarding situations when we should use those kinds of controls and when we shouldn't. As long as the Web exists, developers want to make a rich UI client within their Web applications. UI components like hierarchy trees, drill down menus and so on spread their charm on us and sometimes on our customers. We are all used to see it in WinForms and we like to see it also in our Web applications - why not? if to ask... There are several why not answers that even a non UI expert, like me, can raise.
There used to be other problems like IE compatibility, slow network connections and lacking the necessary set of script languages features - but thanks god, they were over. OK, before I'll start to drill down into the drill menu bits, I would like to point that my version base on the great XML & XSL & JS code was originally written by Dan Wahlin and I got his permission to add my enhancements (I'm not the only one). You can find the original bits at Dan's web site on XML which is recommended for anyone who is interested in .NET and specifically with XML for ASP.NET. The drill down menu major feature list
It is recommended to use the Actually, there are more different configuration options and there is also a way to combine different options and get a mixed behavior. I download ZIP file including the code of the Web control and 6 simple samples about different ways you can configure the menu metadata XML. Menu global settingspublic struct MenuSettingsType
{
public string name;
public bool forcePermission;
public bool ommitNotAuthMenus;
public string defaultLink;
public string customCSSFile;
public string customJSFile;
public string customXSLFile;
public bool recheckPermissionsOnPostBack;
public bool triggerPostBack;
public string appFolder;
public string port;
public string frameDivHolderID;
public string customOnClick;
public bool customOnClickIsInFrame;
public bool canNavigateIsInFrame;
}
Most of the settings are optional. The following settings can be overridden by specific menu item settings. public string defaultLink;
public bool triggerPostBack;
public string frameDivHolderID;
public string customOnClick;
public bool customOnClickIsInFrame;
public bool canNavigateIsInFrame;
Menu Item Metadata//the name (id) of your menu (mandatory)
public const string EL_NAME= "name";
//comma delimiter roles that can access this menu item content (optional)
public const string EL_PERMISSIONS="permissions";
//check the user permissions for this menu item (optional)
public const string EL_FORCE_PERMISSIONS="forcePermission";
//the display name of this menu item (mandatory)
public const string EL_CAPTION="caption";
//the tooltip (optional)
public const string EL_TOOL_TIP="toolTip";
//the mode the menu item will be display (optional)
public const string EL_DISABLED="disabled";
//the default message for tooltip for not authorized user (optional)
public const string EL_ACCESS_DENIED_MESSAGE="accessDeniedMessage";
//not implemented
public const string EL_VISIBLE="visible";
//is the menu clicked should trigger a postback - true/false (optional)
public const string EL_TRIGGET_POSTBACK="triggerPostBack";
//the target link the menu item point to (optional)
public const string EL_LINK="link";
//the valid value: PostBack, Window, Frame (mandatory)
public const string EL_CLIENT_OPEN_TARGET_TYPE="clientOpenTargetType";
//the DIV where the IFRAMES will be located in IFRAME mode
//(mandatory in IFRAME MODE)
public const string EL_CLIENT_FRAMES_DIV_ID="clientFramesDivHolderName";
//your function name that provide additional parameters
//and will be called after a menu item was clicked and before the menu
//item will start its internal logic (optional)
public const string EL_CLIENT_PARAMS_GET_FN="clientParamsGetFunction";
//dialog or window. default is dialog. (optional)
public const string EL_CLIENT_WINDOW_TYPE="clientWindowType";
//the name of your function that will be triggered after a window will be
//closed when menu item open a window (optional)
public const string EL_CLIENT_AFTER_WIN_CLOSE_FN="clientWindowAfterCloseEvent";
//your function name that will be called before a window will open
//and will be use to get the window preferences string (optional)
public const string EL_CLIENT_GET_WIN_STYLE_FN="clientWindowGetStyleFuncName";
//when working in IFRAME mode and you want to use single IFRAME with
//postback to this IFRAME loading page (see attach sample)
//the clientTargetFrameName value should point to your single IFRAME (optional)
public const string EL_CLIENT_TAGET_FRAME_NAME="clientTargetFrameName";
//your custom on menu item click handler (optional)
public const string EL_CLIENT_CUSTOM_CLICK_FN="customOnClick";
//this settings specify where your custom on click function located (optional)
public const string EL_CLIENT_CUSTOM_CLICK_IN_FRAME="customOnClickIsInFrame";
//this settings specify where canNavigate function located (optional)
public const string EL_CLIENT_CAN_NAV_IN_FRAME="canNavigateIsInFrame";
The mandatory elements are: //the unique name (id) of the menu
public const string EL_NAME= "name";
//the display name
public const string EL_CAPTION="caption";
//There are three types: PostBack or Window or Frame
public const string EL_CLIENT_OPEN_TARGET_TYPE="clientOpenTargetType";
When you are working in The XML size depends on the different elements you are using. Most of the menu items metadata elements are optional. Its also depend on the behavior configuration you need - using PostBack to the same page, using The web control, server side functionalityAs already mentioned, there are three server side events you can subscribe and change the final results. public delegate void MenuItemClickedHandler(MenuItemClickedEventArgs e);
public delegate void MenuItemRanderHandler(XmlNode item, out bool skipItem,
out string xmlAdditionalAttr);
public delegate void MenuItemCheckPermissionHandler(XmlNode menu,
string permissions, bool forcePermissions, string caption,
string originalToolTip, out bool skip,
out bool enable, out string toolTip);
The The menu element definition within ASP.NET page<?XML:NAMESPACE PREFIX = CC1 /><CC1:DDMENU id=DDMenu1
dir=ltr MenuName="FramesAndPostBackToFrame"
MenuXMLFileName="FramesAndPostBackToFrame.xml"
MenuXMLRelPath="menu" runat="server">
</CC1:DDMENU>
When using Frame mode you need to add the ImportantWhen working with single Samples code files attached
The sample includes RTL / LTR samples. Few remarks
SummaryThe article mostly explain the different ways to configure the
|
||||||||||||||||||||||