IControlPanel.GetCategory(String, ModulePageInfo) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Retrieves the Home page category of the feature that is associated with the specified category string.
public:
Microsoft::Web::Management::Client::ControlPanelCategoryInfo ^ GetCategory(System::String ^ categorization, Microsoft::Web::Management::Client::ModulePageInfo ^ pageInfo);
public Microsoft.Web.Management.Client.ControlPanelCategoryInfo GetCategory (string categorization, Microsoft.Web.Management.Client.ModulePageInfo pageInfo);
abstract member GetCategory : string * Microsoft.Web.Management.Client.ModulePageInfo -> Microsoft.Web.Management.Client.ControlPanelCategoryInfo
Public Function GetCategory (categorization As String, pageInfo As ModulePageInfo) As ControlPanelCategoryInfo
Parameters
- categorization
- String
The category string that was used to register the category.
- pageInfo
- ModulePageInfo
The ModulePageInfo object that is associated with the specified categorization
string.
Returns
The ControlPanelCategoryInfo object of which the current feature is a member, or null
if the feature does not belong to any category.
Examples
The following example uses the category information to group features.
protected override void OnGroup(
ModuleListPageGrouping grouping) {
ListView.BeginUpdate();
try {
if ((grouping == null) ||
(grouping == EmptyGrouping)) {
return;
}
// Get the dictionary of groups for
// this category type
IDictionary<string, ListViewGroup>
groups = GroupingsTable[grouping.Name];
IControlPanel controlPanel =
(IControlPanel)GetService(typeof(IControlPanel));
foreach (PageListViewItem item
in ListView.Items) {
ControlPanelCategoryInfo categoryInfo =
controlPanel.GetCategory(
grouping.Name, item.PageInfo);
ListViewGroup group = null;
if (categoryInfo != null) {
group = groups[categoryInfo.Text];
}
// If we couldn't find a group,
// assign it to the 'Other' group
if (group == null) {
group = groups["Other"];
}
item.Group = group;
}
} finally {
ListView.EndUpdate();
}
}
Remarks
This method enables you to map from a page back to the Home page category it is contained within for the specified category type.
Home page categories include Application Development, Health and Diagnostics, HTTP Features, Performance, Security, and Server Components.