RadGridView display cell string value

2 Answers 53 Views
GridView
Vitalii
Top achievements
Rank 1
Iron
Vitalii asked on 07 Dec 2022, 09:56 AM

Hello,

I'd like to display cell value (string) this way

(2) text2

(1) text1

 

not this way

(2) text2 (1) text1

 

How to achieve this behaviour?

Thank you.

Vitalii
Top achievements
Rank 1
Iron
commented on 07 Dec 2022, 09:57 AM

To the point I tried add Environment.NewLine, it does not work.

2 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 07 Dec 2022, 11:05 AM

Hi, Vitalii,

The columns in RadGridView offer the WrapText property which is relevant for each GridViewColumn: 

this.radGridView1.Columns[0].WrapText = true;

Please review this help article for more details concerning RadGridView columns.

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Vitalii
Top achievements
Rank 1
Iron
commented on 07 Dec 2022, 11:34 AM

I tried this before asking the question but nothing happens.

The string was shortened as before with ... at the end.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 07 Dec 2022, 12:39 PM

Hello, Vitalii,  

I have prepared a sample code snippet for your reference which result is illustrated below:

        public RadForm1()
        {
            InitializeComponent();

            GridViewTextBoxColumn textColumn = new GridViewTextBoxColumn();
            textColumn.Width = 50;
            textColumn.WrapText = true;
            this.radGridView1.Columns.Add(textColumn);

            this.radGridView1.Rows.Add("text1 text2");
            this.radGridView1.Rows.Add("text3 " + Environment.NewLine + "text4");
        }

The text is successfully wrapped.

I have attached my sample project. Please give it a try and see how it works on your end. Am I missing something? Could you please specify the exact steps how to reproduce the problem? 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Vitalii
Top achievements
Rank 1
Iron
commented on 07 Dec 2022, 12:52 PM

I figured out that it works only if grid's property AllowRowResize is set to true. In my case it was false.

Anyway - thank you.

Tags
GridView
Asked by
Vitalii
Top achievements
Rank 1
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or