Hi
I'm manually filling a webExplorerBar, and it draws perfectly, the user can remove some items on the explorer bar by pressing a button, when this happens i want to redraw the ExplorerBar to show the new items but i got the Groups been duplicated and the new duplacated group show no visual style
I call this code the first time the ExplorerBar is shown and also when i need to refresh it.
webOpciones.Groups.Clear()
For Each drGrupo As DataRow In OpcionesUsuario.dtGrupos.Rows
oGrupo = New ExplorerBarGroup(drGrupo("GroupName"), drGrupo("id_Group")) webOpciones.Groups.Add(oGrupo)
For Each drOpcion As DataRowView In dvOpciones New ExplorerBarItem(drOpcion("Name"), "", drOpcion("URL"), drOpcion("Image"))
lOpcion = lOpcion.DataItem = drOpcion
oGrupo.Items.Add(lOpcion) NextNext
Regards.
Hi,
one what stage of the page lifecycle you execute this code? If you do it before LoadViewState is done, then the groups will be indeed duplicated.
Also as I look at the code I think that the first block where you populate the groups should not be called on postback. You should have if(!IsPostback) and then load the groups from the Rows.
Because once the explorer bar is loaded with data it preserve is in the view state. And when you do a postback(in case of a button click) there is no need to load the whole explorer bar again.
Thanks,
Lubomir
Lubomir,
We are trying to do this scenario on purpose. We are using the ExplorerBar as a set of grouped filters. When we 'apply' a filter we want to completely rebuild the explorerbar to reflect the new set of available options.
Groups.Clear doesn't clear what sounds like is the data in the ViewState.
I'm assumming I could do something so that the Explorerbar doesn't use ViewState but then I would have to build it on every postback. That isn't terrible except the logic to generate the data for the toolbar could take a while. I suppose we could cache the data between 'DoFilterAction' clicks but that just adds more compexitity.
Any advice? I would think that Clearing the groups should be smart enough to push the right data back to the client side and fix the issue.
thanks
jack