I have a RadTreeView in a UpdatePanel and a RadListView in another UpdatePanel. I must expanded the parent nodes to the right childnode. When i clicked on the childnode, then i load a details from webservice in the ListView in the other UpdatePanel. This works fine.
The problem is, after i clicked on the childnode and loaded the details, the TreeView is unexpanded and the childnode is deselcted. How can I solve my problem?
Here is my code:
<asp:UpdatePanel ID="UpdatePanel2" runat="server" onload="UpdatePanel2_Load"> |
<ContentTemplate> |
<telerik:RadTreeView ID="rtvLayoutListe" runat="server" AutoPostBack="true" Height="450px" |
Skin="Office2007" OnClientNodeClicking="ClientClickHandler" |
oncontextmenuitemclick="rtvLayoutListe_ContextMenuItemClick" |
OnNodeClick="rtvLayoutListe_NodeClick" |
onclientcontextmenuitemclicking="ContextMenuClicking" |
onclientnodeclicked="ClientClickedHandler"> ..... </
ContextMenus>
</telerik:RadTreeView>
</ContentTemplate>
</asp:UpdatePanel> <
asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers> </Triggers> <ContentTemplate> <h3><asp:Label ID="lblContainerNameH3" runat="server" Text=""></asp:Label></h3> <telerik:RadListBox ID="rlbObjectList" runat="server" AllowDelete="True" AllowReorder="True" CssClass="rlbObjects" Skin="Office2007" Width="400px"
<ButtonSettings ShowTransfer="False" ShowTransferAll="False" /> </telerik:RadListBox>
|
Javascript:
function ClientClickHandler(sender, eventArgs) { |
var node = eventArgs.get_node().get_value(); |
if (!node.startsWith("container-")) { |
eventArgs.set_cancel(true); |
return false; |
} |
} |
C#:
protected
void UpdatePanel2_Load(object sender, EventArgs e) { GenerateTreeView(); }
public
void GenerateTreeView()
{ rtvLayoutListe.Nodes.Clear();
layoutsql lsql = new layoutsql();
DataSet ds = lsql.GetLayoutsForManager(); ... } protected void rtvLayoutListe_NodeClick(object sender, RadTreeNodeEventArgs e) |
{ |
if (e.Node.Value.StartsWith("container-")) |
{ |
lblContainerNameH3.Text = "Container: " + e.Node.Text; |
objectssql osql = new objectssql(); |
rlbObjectList.DataSource = osql.LoadCurrentContainers(int.Parse(e.Node.Value.Substring(10))); |
rlbObjectList.DataBind(); |
lblContainerNameH3.Text += " - Time: " + new TimeSpan(0, 0, timecounter).ToString(); |
} |
else |
{ |
lblContainerNameH3.Text = ""; |
} |
} |
I saw, after the click on the Node - the UpdatePanel makes a new load.
Reiner