Getting a RadTreeView added Dynamically on a ComboBox Client-Side

1 posts, 0 answers
  1. Denis
    Denis avatar
    18 posts
    Member since:
    Feb 2012

    Posted 08 Dec 2012 Link to this post

    Hi Team,

    I have very peculiar process.

    I am adding in my page on code-behind in the Init of the page a Radcombobox with a dynamic ID. Furthermore I am adding a RadtreeView to it on codebehind with a fix id and with only one node

    using this idea:
    ...
     public void InstantiateIn(Control container)
            {
                RadTreeView tree = new RadTreeView();
                tree.ID = "tv";
                tree.CheckBoxes = true;
                tree.ExpandAllNodes();
                container.Controls.Add(tree);

    ...

    Now my big deal is I want to load that RadTreeView on demand and client-side . My problem came with the JavaScript that is not fiding the controls that have been added on the code behind

    I try to add on the load page using a RadCodeBlock the script to find the control but it is not working. Also I tried Sys.Application.add_load(ale)


    something like this:
    System.Text.StringBuilder sb = new System.Text.StringBuilder();     
                sb.Append(@"<script language='javascript'>");
                sb.Append(@"Sys.Application.add_load(ale);");
                sb.Append(@"alert('Hello World');");
                sb.Append(@"var comboBOX = document.getElementById('<%= 2.ClientID %>'); ");
                sb.Append(@"function ale(){alert(comboBOX);}");
                sb.Append(@"</script>");

    Could you help me with an example or some guidance to get the ComboBox that I loaded dynamically with a dynamic ID on Java Script or JQuery. When I get the comobo box how the treeview has a predefined ID I will be able to get it on client-side.

    Thank you
                LiteralControl literaJS = new LiteralControl(sb.ToString());
                RadCodeBlockFilterControl.Controls.Add(literaJS);
Back to Top