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

Wrapping Text in Cell

4 Answers 231 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Fakhru
Top achievements
Rank 2
Fakhru asked on 03 Sep 2009, 01:28 PM
How to mimic behavior of DataGridView TextWrapping in RadGridView ?
I have set RadGridView cell Wrap = true, and AutoRowHeight = true, but the result is Output
Did I miss something?


Best Regards,
Fakhru Rahman



4 Answers, 1 is accepted

Sort by
0
Fakhru
Top achievements
Rank 2
answered on 05 Sep 2009, 02:23 AM
Any solutions ?
I'm trying to upgrade all my DataGridView to RadGridView.


Best Regards,
Fakhru Rahman
0
Martin Vasilev
Telerik team
answered on 08 Sep 2009, 10:53 AM
Hi Fakhru,

Thank you for writing. I think that if you use min height for rows, RadGridView will look closer to the standard DataGridView. Please, review the following code-block:

private void Form1_Load(object sender, EventArgs e)  
{  
    this.radGridView1.Columns[1].WrapText = true;  
    this.radGridView1.AutoSizeRows = true;  
}  
 
void radGridView1_CreateRow(object sender, Telerik.WinControls.UI.GridViewCreateRowEventArgs e)  
{  
    if (e.RowInfo is GridViewTableHeaderRowInfo)  
    {  
        e.RowInfo.MinHeight = 30;  
    }  
    else 
    {  
        e.RowInfo.MinHeight = 20;  
    }  
}  
 
 

Hope this helps. Do not hesitate to contact me again if you have other questions.

Sincerely yours,
Martin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Fakhru
Top achievements
Rank 2
answered on 12 Sep 2009, 12:12 PM
That code was I'm looking for.
But  when there's some not displayed row, the first not displayed row was not effected with that MinHeight value.

Sorry, I have bad English.
If you can't understand what I mean, maybe I can send some screenshoot of it, :P.


Best Regards,
Fakhru Rahman.
0
Martin Vasilev
Telerik team
answered on 16 Sep 2009, 11:11 AM
Hello Fakhru,

Thank you for getting back to me.

After some testing I have to admit that we have an issue with MinHeight property, and that's why the provided code is not working as expected. I have logged this in our bug tracking system and it will be addressed for some of the next releases. Currently, you can try to use CellElement Padding to achieve similar result. Please, review the code-block below:

private void Form1_Load(object sender, EventArgs e) 
    this.radGridView1.Columns[1].WrapText = true
    this.radGridView1.AutoSizeRows = true
 
void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e) 
   e.CellElement.Padding = new Padding(6); 
 
Write me back if you need additional assistance.

Kind regards,
Martin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Fakhru
Top achievements
Rank 2
Answers by
Fakhru
Top achievements
Rank 2
Martin Vasilev
Telerik team
Share this question
or