This is a migrated thread and some comments may be shown as answers.

Treeview in Combobox

2 Answers 128 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
towpse
Top achievements
Rank 2
towpse asked on 30 Sep 2008, 08:06 PM

Hopefully this inqury is a quick one although I have 2 issues.

I just migrated to the ajax asp treeview.


1.



I want a tree inside a combo box type of functionality. Following a sample I found on this site, my original setup looked like this:

<

asp:TextBox ID="txtSelection" ReadOnly="true" runat="server"></asp:TextBox>
<asp:Image runat="server" ID="imgBoxArrow" ImageUrl="~/Images/boxArrow.gif" onclick="ToggleTreeView()" />
<asp:RequiredFieldValidator ID="required" runat="server"Text = "*" Visible= "true" ControlToValidate="txtSelection" Display="Dynamic" />
<div id="tvDiv" class="treeDiv">
<asp:UpdatePanel ID="UpdatePanelTreeView" runat="server">
<ContentTemplate>
<radT:RadTreeView ID="tv" runat="server" Height="200px" Width="100%" EnableViewState="true"RetainScrollPosition="true" RadControlsDir="/RadControls/" SkinsPath="/RadControls/Treeview/Skins"AutoPostBack="False" OnNodeExpand="tv_OnNodeExpand" BeforeClientClick="BeforeClientNodeClick"AfterClientClick="AfterClientNodeClick" />
</ContentTemplate>
</asp:UpdatePanel>
</div>

You Click on the arrow image and it fires a java script function to show the div that contains the tree view.

This is probably rather old school since I should be able to use the item template of a rad combo.

I have an example that I'm trying to follow here
http://demos.telerik.com/aspnet/prometheus/TreeView/Examples/Functionality/TreeViewComboBox/DefaultCS.aspx

Seems simple enough but if the tree view is in the item template of the combo box, how can I get a reference to the tree view server side?


2.



Also... Pretend that the rad tree view in that above sample is the ajax asp tree. When I expand the node on the ajax asp tree view, the validators on my page all fire and if not all satisfied then the expand will not complete. This was not happening with the classic tree. Any thoughts? It's triggering a full post back whereas the classic one did not?

I thought I might be able to leverage the before and after clicks: disable the validators before click. As it stands, however, the post back will occur after the after node click fires client side at which point I should be turning the validators back on in case they need to block the postback...


Regards.

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 01 Oct 2008, 06:17 AM
Hi Matt,

Go through the following help article which explains how to access a TreeView control nested in the ItemTemplate of a RadCombobox on the server side.
Finding an item in template

Regards
Shinu.
0
towpse
Top achievements
Rank 2
answered on 01 Oct 2008, 01:15 PM
Ah of course. Thanks Shinu. I completely forgot about this. Brain fart I guess.

Regards.
Tags
TreeView
Asked by
towpse
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
towpse
Top achievements
Rank 2
Share this question
or