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

How to set edit text box height?

1 Answer 146 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Frank
Top achievements
Rank 1
Frank asked on 08 Apr 2009, 12:16 PM
I am setting the width for a RadGrid multiline edit text box programmatically (see below) - this works fine. I'd also like to set the height of the edit text box to the height of the edited line, i.e. the height of the line should not change when editing and the edit box should be high enough to show the entire cell context.

However, this does not work. The height of the edited line actually shrinks when I hit "edit" and the edit box therefore only shows the first line or so. Any idea what I am doing wrong?

Thanks for looking into this.

  Private Sub RadGrid1_ItemDataBound(ByVal sender As ObjectByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound  
 
        If (TypeOf e.Item Is GridEditableItem) AndAlso (e.Item.IsInEditMode) Then 
 
            Dim editedItem As GridEditableItem = e.Item  
            Dim wte As GridTextBoxColumnEditor = TryCast(editedItem.EditManager.GetColumnEditor("BUG_KURZTEXT"), GridTextBoxColumnEditor)  
            Dim txtbx As TextBox = wte.TextBoxControl  
 
            With txtbx  
                .TextMode = TextBoxMode.MultiLine  
                .Width = Unit.Percentage(100)  
                .Height = Unit.Percentage(100)  '<--- this line has no effect  
            End With 
 
 
        End If 
 
    End Sub 

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 08 Apr 2009, 12:51 PM
Hello Frank,

In case you are using IE7, this browser ignores 100% heights for textboxes, as demonstrated by this simple example:

<table><tr><td style="height:100px;border:1px solid red">
<input type="text" style="height:100%" />
</td></tr></table>

(the above works for Firefox or IE8)

Please consider using a pixel height for IE7 or all browsers.

Kind regards,
Dimo
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Frank
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or