RadTreeView checkbox how to check it automatically

3 posts, 0 answers
  1. John
    John avatar
    3 posts
    Member since:
    Jul 2011

    Posted 15 Jul 2011 Link to this post

    Hi,

    I have to use VBScript and have to check the checkbox automatically, I mean, do smth like this:
    doc.GetElementById("ResetPasswordCheckBox").Checked = True or
    doc.GetElementById("saveBtn").Click
    etc. where doc = ie.document

    But when I try to implement these sentences, nothing works:

    doc.GetElementById("UserGroupsTree").Nodes(0).Checked
    doc.GetElementById("UserGroupsTree").Nodes(1).Selected
    doc.GetElementById("UserGroupsTree").Nodes(2).Selected
    doc.GetElementById("UserGroupsTree").SelectedNodes.Count
    doc.GetElementById("UserGroupsTree").Nodes(0).Text
    doc.GetElementById("UserGroupsTree").Nodes(1).Text
    doc.GetElementById("UserGroupsTree").Nodes(2).Text
    doc.GetElementById("UserGroupsTree").Nodes(0).Value
    doc.GetElementById("UserGroupsTree").Nodes(1).Value
    doc.GetElementById("UserGroupsTree").Nodes(2).Value

    The html code contains smth like this:

     

    <div id="UserGroupsTree"

    class="RadTreeView RadTreeView_Default"

    style="overflow:auto;height:100%;width:100%;">

     

    <ul class="rtUL rtLines">

    <li class="rtLI rtFirst rtLast">

    <div class="rtTop">

    <span class="rtSp"></span>

    <span class="rtPlus"></span>

    <input type="checkbox" class="rtChk" />

    <span class="rtIn">Some Text</span>

    </div>

    </li>

    </ul>

    <input id="UserGroupsTree_ClientState" name="UserGroupsTree_ClientState" type="hidden" />

    </div>

    And I want  to set this checkbox to "true" automatically, by means of script, i.e. simulating user clicking

    And my script can access user machine only, no access to server side.

    I 'm limited to vbscript only (script which runs on client side, not server side)

    Perhaps I'm trying to do smth wrong but any help is greatly appreciated,

    Thanks in advance,
    John

     

  2. John
    John avatar
    3 posts
    Member since:
    Jul 2011

    Posted 20 Jul 2011 Link to this post

    Hi,

    Finally I found the solution  - how to check the checkboxes within the UserGroupsTree scope:

    Dim NodeList As Variant
    Set NodeList = doc.getElementById("UserGroupsTree").getElementsByTagName("input"
     For Each elem In NodeList 
            If elem.getattribute("type") = "checkbox" Then
            elem.Checked = 1 
          End If

    But now there is another problem: how to expand all the nodes by means of vbscript?

    Unfortunately,

    set treeObj = document.getElementById("UserGroupsTree").object

    does not work and I cannot do like this: treeObj.ExpandAll (as described in this article http://www.telerik.com/help/aspnet/treeview/tree_expand_client_side.html)

    Is there any way to overcome this issue?

    How to get the client-side instance of the treeview object by means of VBscript
    like in javascript

    var treeviewInstance = <%RadTreeView1.ClientID %>

    Best regards,
    John

  3. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 22 Jul 2011 Link to this post

    Hi John,

    Telerik RadControls for ASP.NET AJAX are not compatible with vbscript, you should use javascript instead.

    All the best,
    Dimitar Terziev
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Back to Top