Prev | Current Page 579 | Next

Rob Cameron and Dale Michalk

"Pro ASP.NET 3.5 Server Controls and AJAX Components"

OnInit(e);
_currentWebPartManager =
WebPartManager.GetCurrentWebPartManager(Page);
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
String browseModeName = WebPartManager.BrowseDisplayMode.Name;
CHAPTER 10 ?–  OTHER S ERVER C ONTROLS 459
//Reset items collection on dropdown
displayModeDropDown.Items.Clear();
// Fill the DropDown with the names of supported display modes.
foreach (WebPartDisplayMode mode
in _currentWebPartManager.SupportedDisplayModes)
{
String modeName = mode.Name;
// Make sure a mode is enabled before adding it.
if (mode.IsEnabled(_currentWebPartManager))
{
ListItem item = new ListItem(modeName, modeName);
displayModeDropDown.Items.Add(item);
}
}
// If shared scope is allowed for this user, display the scope-switching
// UI and select the appropriate radio button for the current user scope.
if (_currentWebPartManager.Personalization.CanEnterSharedScope)
{
personalizationScopePanel.Visible = true;
if (_currentWebPartManager.Personalization.Scope
== PersonalizationScope.User)
userRB.Checked = true;
else
sharedRB.Checked = true;
}
ListItemCollection items = displayModeDropDown.Items;
int selectedIndex =
items.IndexOf(items.FindByText(_currentWebPartManager.


Pages:
567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591