Setting Indeterminate check state - this time - on server side

2 posts, 0 answers
  1. Aykut
    Aykut avatar
    25 posts
    Member since:
    Feb 2009

    Posted 04 May 2009 Link to this post

    Hi,
    Is it possible to set a node's checked state to indeterminate even if it doesn't have child nodes?
    And I want to do it on server side this time.
    I tried to use your previous reply but it couldnt find the node :

    ScriptManager.RegisterStartupScript(Page, typeof(Page), "aa", RadTreeView1.Nodes[i].ClientID+".get_checkBoxElement().className = 'rtIndeterminate';", true);

    Regards.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 05 May 2009 Link to this post

    Aykut,

    I tried different approach for achieving this functionality. I have added an HiddenField control and passed the value to client side in order to apply the desired class for RadTreeNode in client side. Here is the code which I tried.

    ASPX:
     
    <telerik:radtreeview id="RadTreeView1" runat="server" CheckBoxes="true"
    <Nodes> 
     . . . 
    </Nodes> 
    </telerik:radtreeview> 
    <asp:HiddenField ID="HiddenField1" runat="server" /> 

    CS:
     
    protected void Button3_Click(object sender, EventArgs e) 
        int i = 0; 
        HiddenField1.Value = i.ToString(); 
        string script = "<script language='javascript' type='text/javascript'>Sys.Application.add_load(test);</script>"
        ClientScript.RegisterStartupScript(this.GetType(), "test", script); // Call the client function to apply CSS 

    JavaScript:
     
    <script type="text/javascript"
    function test() 
        var value = document.getElementById('HiddenField1').value; //Get value passed from server 
        var tree = $find("<%= RadTreeView1.ClientID %>"); 
        var node = tree.get_nodes().getNode(value); 
        node.get_checkBoxElement().className = "rtIndeterminate"
    </script> 

    Thanks,
    Shinu.
Back to Top