/// <summary> /// Gets tree node icon /// </summary> /// <param name="node">Tree node</param> /// <param name="data">Source data</param> private string GetNodeIconMarkup(UniTreeNode node, DataRow data) { string imagePath = null; string iconClass = null; // Get image path from data if (!string.IsNullOrEmpty(ProviderObject.ImageColumn)) { imagePath = ValidationHelper.GetString(data[ProviderObject.ImageColumn], null); } // Get icon class from data if (!string.IsNullOrEmpty(ProviderObject.IconClassColumn)) { iconClass = ValidationHelper.GetString(data[ProviderObject.IconClassColumn], null); } // Get image or icon from external event if (OnGetImage != null) { // Set node as event argument var args = new UniTreeImageArgs { TreeNode = node }; OnGetImage.StartEvent(args); // Get image or icon class if (string.IsNullOrEmpty(imagePath) && !string.IsNullOrEmpty(args.ImagePath)) { imagePath = args.ImagePath; } else if (string.IsNullOrEmpty(iconClass) && !string.IsNullOrEmpty(args.IconClass)) { iconClass = args.IconClass; } } // If no definition found, use default image path if (string.IsNullOrEmpty(imagePath) && string.IsNullOrEmpty(iconClass)) { // Image path has higher priority if (!string.IsNullOrEmpty(DefaultImagePath)) { imagePath = DefaultImagePath; } else if (!string.IsNullOrEmpty(DefaultIconClass)) { iconClass = DefaultIconClass; } } return(UIHelper.GetAccessibleImageMarkup(Page, iconClass, imagePath, size: FontIconSizeEnum.Standard)); }
/// <summary> /// Method for obtaining image URL for given tree node (category). /// </summary> /// <param name="sender">Sender object</param> /// <param name="args">Event arguments wrapper</param> protected void treeElem_OnGetImage(object sender, UniTreeImageArgs args) { DataRow dr = args.TreeNode.ItemData as DataRow; if (dr == null) { return; } bool personal = ValidationHelper.GetInteger(dr["CategoryUserID"], 0) > 0; if (personal && !String.IsNullOrEmpty(PersonalCategoriesImageUrl)) { args.ImagePath = PersonalCategoriesImageUrl; } else if (!String.IsNullOrEmpty(CategoriesImageUrl)) { args.ImagePath = CategoriesImageUrl; } }
/// <summary> /// On get image event. /// </summary> /// <param name="sender">Sender object</param> /// <param name="args">Event arguments wrapper</param> protected void treeElem_OnGetImage(object sender, UniTreeImageArgs args) { if ((args.TreeNode != null) && (args.TreeNode.ItemData != null)) { string objectType = string.Empty; DataRow dr = (DataRow)args.TreeNode.ItemData; if (dr != null) { objectType = ValidationHelper.GetString(dr["ObjectType"], "").ToLowerCSafe(); } // Return image path if (objectType == "report") { args.ImagePath = GetImageUrl("Objects/Reporting_Report/object.png"); } else if (objectType == "reportcategory") { args.ImagePath = GetImageUrl("Objects/Reporting_ReportCategory/list_tree.png"); } } }
/// <summary> /// Gets tree node icon /// </summary> /// <param name="node">Tree node</param> /// <param name="data">Source data</param> private string GetNodeIconMarkup(UniTreeNode node, DataRow data) { string imagePath = null; string iconClass = null; // Get image path from data if (!string.IsNullOrEmpty(ProviderObject.ImageColumn)) { imagePath = ValidationHelper.GetString(data[ProviderObject.ImageColumn], null); } // Get icon class from data if (!string.IsNullOrEmpty(ProviderObject.IconClassColumn)) { iconClass = ValidationHelper.GetString(data[ProviderObject.IconClassColumn], null); } // Get image or icon from external event if (OnGetImage != null) { // Set node as event argument var args = new UniTreeImageArgs { TreeNode = node }; OnGetImage.StartEvent(args); // Get image or icon class if (string.IsNullOrEmpty(imagePath) && !string.IsNullOrEmpty(args.ImagePath)) { imagePath = args.ImagePath; } else if (string.IsNullOrEmpty(iconClass) && !string.IsNullOrEmpty(args.IconClass)) { iconClass = args.IconClass; } } // If no definition found, use default image path if (string.IsNullOrEmpty(imagePath) && string.IsNullOrEmpty(iconClass)) { // Image path has higher priority if (!string.IsNullOrEmpty(DefaultImagePath)) { imagePath = DefaultImagePath; } else if (!string.IsNullOrEmpty(DefaultIconClass)) { iconClass = DefaultIconClass; } } return UIHelper.GetAccessibleImageMarkup(Page, iconClass, imagePath, size: FontIconSizeEnum.Standard); }
/// <summary> /// On get image event. /// </summary> /// <param name="sender">Sender object</param> /// <param name="args">Event arguments wrapper</param> protected void treeElem_OnGetImage(object sender, UniTreeImageArgs args) { if ((args.TreeNode != null) && (args.TreeNode.ItemData != null)) { string objectType = string.Empty; DataRow dr = (DataRow)args.TreeNode.ItemData; if (dr != null) { objectType = ValidationHelper.GetString(dr["ObjectType"], "").ToLowerCSafe(); } // Return image path if (objectType == "report") { args.ImagePath = GetImageUrl("Objects/Reporting_Report/object.png"); } else if (objectType == "reportcategory") { args.ImagePath = GetImageUrl("Objects/Reporting_ReportCategory/list_tree.png"); } } }
/// <summary> /// Method for obtaining image URL for given tree node (category). /// </summary> /// <param name="sender">Sender object</param> /// <param name="args">Event arguments wrapper</param> protected void treeElem_OnGetImage(object sender, UniTreeImageArgs args) { DataRow dr = args.TreeNode.ItemData as DataRow; if (dr == null) { return; } bool personal = ValidationHelper.GetInteger(dr["CategoryUserID"], 0) > 0; if (personal && !String.IsNullOrEmpty(PersonalCategoriesImageUrl)) { args.ImagePath = PersonalCategoriesImageUrl; } else if (!String.IsNullOrEmpty(CategoriesImageUrl)) { args.ImagePath = CategoriesImageUrl; } }