Textboxex in a RadTreeView

8 posts, 0 answers
  1. Philip Saltskog
    Philip Saltskog avatar
    60 posts
    Member since:
    Mar 2004

    Posted 05 Nov 2008 Link to this post

    I'm using version 2008.2.820.35 and I've successfully add textboxex to each node and also a literal text there too, but I can't get it out there with findcontrol??

    Dim nodeCollection As System.Collections.Generic.IList(Of RadTreeNode) = R1.CheckedNodes  
    Dim node As RadTreeNode  
    For Each node In nodeCollection  
        Dim testCount As Integer = node.Controls.Count  
        Dim boxBanner As TextBox = node.FindControl("boxBannerID" & node.Value)  
    next node 

    Any ideas why I don't get it from the node in the IList?

    /Thanks
  2. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 06 Nov 2008 Link to this post

    Hi Philip Saltskog,

    It is difficult to say why this is happening only by looking at this code.

    Could you provide more information such as how the TextBoxes are added to Nodes? How are their IDs generated?

    Thank you in advance.

    Sincerely yours,
    Simon
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Philip Saltskog
    Philip Saltskog avatar
    60 posts
    Member since:
    Mar 2004

    Posted 06 Nov 2008 Link to this post

    When I'm create the box I use this code.


     

    Dim myBox As New TextBox   
    myBox.ID = "boxBannerID" & dbRow("ID")   
    node.Controls.Add(myBox)  

    dbRow is a datarow in a datalist from DB.

    .aspx page
    <input name="R1$i0$i0$boxBannerID79" type="text" value="3" id="R1_i0_i0_boxBannerID79" class="brodtext" style="width:20px;" />

     

  4. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 06 Nov 2008 Link to this post

    Hello Philip Saltskog,

    Thank you for the additional information.

    Controls added to Nodes in this way should be added on each postback, and not only on the first page load. Could you please make sure that this is realized in your case?

    You can avoid this issue, however, by using dynamic runtime Templates as shown in this help article.

    Greetings,
    Simon
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Philip Saltskog
    Philip Saltskog avatar
    60 posts
    Member since:
    Mar 2004

    Posted 07 Nov 2008 Link to this post

    I'm now using the template class, but I'm still not get anything with findcontrol?
    Dim boxBanner As TextBox = node.FindControl("boxBannerID" & node.Value) 

    For each node i call
    template.InstantiateIn(node) 
    but when I'm use postback it's empty. Even if I call my sub from a postback it's empty of controls. I only get the node control here.

    Any ideas?

    /Thanks
  6. Philip Saltskog
    Philip Saltskog avatar
    60 posts
    Member since:
    Mar 2004

    Posted 07 Nov 2008 Link to this post

    I solved it with request.form :)
    Dim boxBanner As String = Request.Form(node.UniqueID & "$boxBannerID" & node.Value) 
    When the postback come the textbox is disappeared, but I think you have a solution on this soon :)!?? Might allready have any solution?

    That important thing is I get the datavalue from the textbox :)

    /Thanks
  7. Philip Saltskog
    Philip Saltskog avatar
    60 posts
    Member since:
    Mar 2004

    Posted 07 Nov 2008 Link to this post

    Found another strange behavior.

    When I add controls to the node I get wrong node.value on the checked nodes. If I checked two nodes and use
    Dim nodeCollection As System.Collections.Generic.IList(Of RadTreeNode) = R1.CheckedNodes 
    I get wrong node on the child node.

    I think this is instable and I will wait till Telerik release som support for controls in a node...

    Telerik: Do you know when you will support that?

    /Thanks
  8. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 07 Nov 2008 Link to this post

    Hi Philip Saltskog,

    Controls are supported by RadTreeView and the best approach is to use Templates.

    Regarding your case, without additional information I will be unable to determine why Templates do not work as expected at your side.

    Could you please open a formal support ticket and send us the problematic pages (or project) there (including the second issue you are experiencing)?

    We will inspect the files and hopefully will provide solutions or temporary workarounds.

    Thank you in advance for your co-operation.

    Sincerely yours,
    Simon
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top