I'm trying out the WebExplorerBar as a replacement for the old UltraWebListBar, which failed to support a few browsers (chrome, safari, pc&mac). Naturally, I want the WebExplorerBar to behave in a similar manner to the UltraWebListBar (while being crossbrowser compatible), but so far I haven't had much luck replacating the same behaviour.
I'm using a masterpage, and don't want to use an IFrame/target. The way it should work is that, on page postback, I programatically tell the WebExplorerBar which item is selected, and it will open that group, and select that item.
First, it was rather difficult to specify which item I wanted. With UltraWebListBar, I could specify the selecteditem by:
NavBar.SelectedItem = NavBar.Groups.FromKey(groupkey).Items.FromKey(itemkey)
Which no longer works, since "SelectedItem" is readonly, and there are no longer item/group collection keys. The only thing I could do was iterate through the groups and items until I found the NavigateURL that matched the current URL, and set that item's selected property to True:
For Each grp In WebExplorerBar1.Groups Dim grpSelected As Boolean = False For Each itm As Infragistics.Web.UI.NavigationControls.ExplorerBarItem In grp.Items If Request.CurrentExecutionFilePath() = ResolveUrl(itm.NavigateUrl) Then itm.Selected = True grpSelected = True Exit For End If Next If grpSelected Then grp.Expanded = True Exit For End If Next
This code executes but apparently does nothing, or is ignored. Upon postback, the WebExplorerBar returns to its initial state, with the first group expanded and nothing visibly selected.
Changing the ViewState on the WebExplorerBar did not help.
What am I doing wrong?
Thanks.
I am having similar issues...
I am trying to set a certain group to be selected on the page_load event.
PsuedoCode:
FindGroup = (From g In WebExplorerBar1.Groups _ Where g.Value = Request("GroupID") _ Select g).First
FindGroup.Selected = TrueFindGroup.Expanded = True
-----
The group is highlighted properly but when the page load you can see it expand and then close back up and the first group is expanded. The exand triangle is even pointing up like the selected group is expanded but when you mouse over it, it changes back.
some of the HTML on the aspx page is:
<form id="form1" runat="server"><asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><ig:WebExplorerBar ID="WebExplorerBar1" runat="server" GroupContentsHeight="" GroupExpandBehavior="SingleExpanded" Width="100%" AnimationEquationType="Bounce" MaxGroupHeight="450px" StyleSetName="RedPlanet">
so somewhere the first group is being set to selected or something, even though the first group is explictily set to NOT selected :<ig:ExplorerBarGroup GroupContentsHeight="" Text="Home" Selected="false" Value="mi6home">
so I dont think its you doing something wrong, I feel it is the control is automatically selecting the first group. I even tried adding the following lines before I selected the group I wanted: WebExplorerBar1.Groups(WebExplorerBar1.SelectedItem.Index).Expanded = False WebExplorerBar1.Groups(WebExplorerBar1.SelectedItem.Index).Selected = False
but those caused an exception as .SelectedItem was Nothing (unless I set Selected="true" on one of the groups in the HTML), and even if I selected one of the groups, it unselected it but still same "NON" results of the group highlighted but not expnaded and the wrong group expanded.
Thanks,
Yes, I also see it expanding for a moment, then closing with the first group expanding. I also played around with forcing all the other groups closed, and items.selected = false.
I've now just tested this in 10.2, and it is still the same undesireable behaviour.
Hi,
the SelectedItem property is read only, the only way you can select an item is to set its property to Selected = true. All other Navigation controls have this property read only.
As to the problem with the group that is not expanding, it happens only in single expanded mode. In single expanded mode there should be always at least one group that is expanded and if the developer doesn't specify a group the first one is expanded. If you have in code set several groups as expanded only the first one should be expanded. Apparently this does not work currently and I'll file an internal bug and address this.
Hi
I have the same issue but only with the last group of my webexplorerbar, it works fine for the four others groups :-S
If i move this group in the third position for example, there is no problem ...
I think that every group set in last position can't be expanded programatically :-(
Is there a way to solve this ?
Thanks !
well its not just the last position for me. the group I am trying to expand and select is in the middle of several of them.
I'm getting this as well. Does anyone have a solutions to this yet?