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

WrapText doesn't work in edit mode

2 Answers 150 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Gary
Top achievements
Rank 1
Gary asked on 14 Apr 2010, 06:53 PM
I've set WrapText = true on my column.  It works fine in read mode, but when I go to edit the value, the wrapping is lost and makes the it very difficult to edit the value of the cell.

2 Answers, 1 is accepted

Sort by
0
Accepted
Mathieu Yargeau
Top achievements
Rank 1
answered on 14 Apr 2010, 07:49 PM
Hello,

After using the WrapText, I faced the same problem. I used a custom editor to solve the problem. The use of an editor may not be necessary, but in my case I had to modify other things at the same time so it was best.

This assigns the custom editor to the cells that uses a TexBox as editor.

private static void RDataGridSummary_EditorRequired(object sender, EditorRequiredEventArgs e)  
{  
    if (e.EditorType == typeof(RadTextBoxEditor))  
    {  
        e.EditorType = typeof(CustomTextBoxEditor);  
    }  

This is a sample of my custom editor.

 

private class CustomTextBoxEditor : RadTextBoxEditor  
{  
    public override void BeginEdit()  
    {  
        base.BeginEdit();  
        EditorElement.Focus();  
 
        ((RadTextBoxEditorElement)EditorElement).Multiline = true;  
        ((RadTextBoxEditorElement)EditorElement).WordWrap = true;  
    }  

 

With only this, it should work correctly. However, I also have the grid's AutoSizeRows property set to true (to resize the row once the text is edited).

I hope this helps.

0
Gary
Top achievements
Rank 1
answered on 14 Apr 2010, 08:50 PM
Thank you...worked perfectly.
Tags
GridView
Asked by
Gary
Top achievements
Rank 1
Answers by
Mathieu Yargeau
Top achievements
Rank 1
Gary
Top achievements
Rank 1
Share this question
or