Treeview in Combobox

3 posts, 1 answers
  1. towpse
    towpse avatar
    224 posts
    Member since:
    Mar 2008

    Posted 30 Sep 2008 Link to this post

    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. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 01 Oct 2008 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. towpse
    towpse avatar
    224 posts
    Member since:
    Mar 2008

    Posted 01 Oct 2008 Link to this post

    Ah of course. Thanks Shinu. I completely forgot about this. Brain fart I guess.

    Regards.
Back to Top