This is a migrated thread and some comments may be shown as answers.

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

2 Answers 165 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tina
Top achievements
Rank 1
Tina asked on 16 Sep 2016, 02:40 PM

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 Answers, 1 is accepted

Sort by
0
Tina
Top achievements
Rank 1
answered on 17 Sep 2016, 09:30 AM
Need help urgently 
0
Magdalena
Telerik team
answered on 20 Sep 2016, 08:35 AM
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.
Tags
General Discussions
Asked by
Tina
Top achievements
Rank 1
Answers by
Tina
Top achievements
Rank 1
Magdalena
Telerik team
Share this question
or