Wrap up/Text can be in new line after certain length of TEXT in RadTreeView in C#

3 posts, 0 answers
  1. Tina
    Tina avatar
    2 posts
    Member since:
    Sep 2016

    Posted 16 Sep Link to this post

    Hi ,

    I need a help regarding RadTreeView , where i would like wrap of Text value to next line according to fix size of text

    Aspx Code 

     

    <td valign="top" style="border: solid 1px #000000" class="style2">
                            <div id="scroll1" style="overflow: auto; height: 825px;width: 480px;">
                                <telerik:RadTreeView ID="rtvCardFileCatEntries" runat="server" OnNodeClick="rtvCardFileCatEntries_NodeClick"
                                    OnNodeExpand="rtvCardFileCatEntries_NodeExpand" Skin="Telerik">
                                    <CollapseAnimation Type="OutQuint" Duration="100"></CollapseAnimation>
                                    <ExpandAnimation Duration="100"></ExpandAnimation>
                                </telerik:RadTreeView>
                            </div>
    </td>

     

     

    code-Cs page

     

     

    rotected void rtvCardFileCatEntries_NodeClick(object sender, RadTreeNodeEventArgs e)
            {
                //If the click came from a Card file category 
                if (e.Node.Level == 1)
                {
                    Guid selectedCardFileEntryId = Guid.Empty;
                    try
                    {
                        selectedCardFileEntryId = new Guid(e.Node.Value);
                    }
                    catch
                    {
                    }
                    if (selectedCardFileEntryId != Guid.Empty)
                    {
                        EntryEntity cardFileEntry = new EntryEntity(selectedCardFileEntryId);
                        ltCardFileEntryHtml.Text = cardFileEntry.EntryHtml; -- Here Text is coming 
                    }
                }
            }

            protected void rtvCardFileCatEntries_NodeExpand(object sender, RadTreeNodeEventArgs e)
            {
                Guid selectedCardFileCategoryId = Guid.Empty;
                try
                {
                    selectedCardFileCategoryId = new Guid(e.Node.Value);
                }
                catch
                {
                }
                if (selectedCardFileCategoryId != Guid.Empty)
                {
                    Collection cardFileEntries = GetCardFileEntries(selectedCardFileCategoryId);
                    e.Node.Nodes.Clear();
                    foreach (EntryEntity cardFileEntry in cardFileEntries)
                    {
                        RadTreeNode node = new RadTreeNode();
                        node.Text = cardFileEntry.Description;---Here Text is coming 
                        node.Value = cardFileEntry.CardFileEntryId.ToString();
                        e.Node.Nodes.Add(node);
                    }
                }
            }

    in UI --on click on button i am getting

    eg:

    Non-Commission Agencies
    Wisconsin Department of Agriculture, Trade and Consumer Protection Agency

     

    Now my requirement to change this above text to 

     

    Non-Commission Agencies --Parent -on click of this (for parent also length of text 50 should come to next line)
    Wisconsin Department of Agriculture,---rest text should come on next line(new line)-(length of text 50 should come to next line)

    Trade and Consumer Protection Agency

     

     

    what are possibilities please advise me .

     

    Thanks in Advance 

     

     

     

     

  2. Tina
    Tina avatar
    2 posts
    Member since:
    Sep 2016

    Posted 17 Sep Link to this post

    Need help urgently 
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Magdalena
    Admin
    Magdalena avatar
    421 posts

    Posted 20 Sep Link to this post

    Hello Tina,

    We are not sure that we have understood you in the right way. If you would like to wrap the child node after the "Agriculture,", you can simply add a <br/> tag in the text of the Node in that place.
    <telerik:RadTreeNode Text="Wisconsin Department of Agriculture,<br/> Trade and Consumer Protection Agency" />


    Regards,
    Magdalena
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top