Hi,
On my page I have a treeview and a separate panel containing nested divs. The structure of my tree is such that a layer (parent) can contain multiple components (children). This is reflected in the panel by the layer (parent div) containing the components (nested divs). Both the layers and the components need to postback when selected in the panel so that the appropriate tree node can be selected.
What I have done is added the following code for both the layers and the components:
This works fine when a layer is selected. The RaisePostBackEvent is called and does what it is supposed to. When a component is selected, however, there is a problem. The RaisePostBackEvent is called twice, the first time for the component, and the second time for the layer. That means that my component is never selected in the tree view and instead the layer always gets selected.
I have tried setting a ViewState variable and a hidden field to mark that the node has already been found, but these values always reset on the second postback.
How can I get around this in order to implement the desired functionality?
Thx.
On my page I have a treeview and a separate panel containing nested divs. The structure of my tree is such that a layer (parent) can contain multiple components (children). This is reflected in the panel by the layer (parent div) containing the components (nested divs). Both the layers and the components need to postback when selected in the panel so that the appropriate tree node can be selected.
What I have done is added the following code for both the layers and the components:
Code:
layer.Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(Me, layer.ID))
component.Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(Me, component.ID))
This works fine when a layer is selected. The RaisePostBackEvent is called and does what it is supposed to. When a component is selected, however, there is a problem. The RaisePostBackEvent is called twice, the first time for the component, and the second time for the layer. That means that my component is never selected in the tree view and instead the layer always gets selected.
I have tried setting a ViewState variable and a hidden field to mark that the node has already been found, but these values always reset on the second postback.
How can I get around this in order to implement the desired functionality?
Thx.