I have attached a screen shot of my "Edit" Form that opens when I click on Edit from the RadGrid. I am trying to find out how you change the display/edit size of certian fields within the "Edit" Form.
For example the field "CorrectiveAction:" is a large "NText" field and I would like to increase the display/edit field in the Edit Form to show more of the field and even make it a scrollable field so you could see all the text in the field.
Another example is in the field "Status:" I would like to make it a dropdown list and not a free form list to all a user to pick an item and not free form the text.
Any help would be appriciated.
Thx,
Alex.
For example the field "CorrectiveAction:" is a large "NText" field and I would like to increase the display/edit field in the Edit Form to show more of the field and even make it a scrollable field so you could see all the text in the field.
Another example is in the field "Status:" I would like to make it a dropdown list and not a free form list to all a user to pick an item and not free form the text.
Any help would be appriciated.
Thx,
Alex.
5 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 03 Jun 2014, 04:49 AM
Hi Alex,
You can set the TextBox width or height by accessing it in the serverside in the ItemDataBound event as shown below. For your next requirement, you can use a GridDropDownColumn or a DropDownList in GridTemplateColumn. For more details take a look at this article on Column Types.
C#:
Thanks,
Princy
You can set the TextBox width or height by accessing it in the serverside in the ItemDataBound event as shown below. For your next requirement, you can use a GridDropDownColumn or a DropDownList in GridTemplateColumn. For more details take a look at this article on Column Types.
C#:
protected
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
//Accessing Edit Form
if
(e.Item
is
GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem editItem = (GridEditableItem)e.Item;
// Access textbox using column UniqueName
TextBox txtAction = (TextBox)editItem[
"CorrectiveAction"
].Controls[0];
txtAction.TextMode = TextBoxMode.MultiLine;
}
}
Thanks,
Princy
0

Alex
Top achievements
Rank 1
answered on 03 Jun 2014, 02:18 PM
Thanks for the reply - do you have a code eample in VB.NET? I am new to Telerik so I am stumbling along with this.
Thanks,
Alex.
Thanks,
Alex.
0

Alex
Top achievements
Rank 1
answered on 03 Jun 2014, 03:01 PM
I got the Code Converted, but it is not liking the "GridEdittableItem" - am I missing an import or something in my code? It also does not like the "GridItemEventArgs" in the definition of the Sub.
Protected Sub RadGrid1_ItemDataBound(sender As Object, e As GridItemEventArgs)
'Accessing Edit Form
If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then
Dim editItem As GridEditableItem = DirectCast(e.Item, GridEditableItem)
' Access textbox using column UniqueName
Dim txtAction As TextBox = DirectCast(editItem("CorrectiveAction").Controls(0), TextBox)
txtAction.TextMode = TextBoxMode.MultiLine
End If
End Sub
Protected Sub RadGrid1_ItemDataBound(sender As Object, e As GridItemEventArgs)
'Accessing Edit Form
If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then
Dim editItem As GridEditableItem = DirectCast(e.Item, GridEditableItem)
' Access textbox using column UniqueName
Dim txtAction As TextBox = DirectCast(editItem("CorrectiveAction").Controls(0), TextBox)
txtAction.TextMode = TextBoxMode.MultiLine
End If
End Sub
0

Alex
Top achievements
Rank 1
answered on 03 Jun 2014, 03:39 PM
Got that fixed - but the field is not changing in the edit mode to "Multiline"..
Ideas why?
Alex.
Ideas why?
Alex.
0

Princy
Top achievements
Rank 2
answered on 04 Jun 2014, 04:20 AM
Hi Alex,
Please add the following ItemDataBound event code snippet:
VB:
Thanks,
Princy
Please add the following ItemDataBound event code snippet:
VB:
Protected
Sub
RadGrid1_ItemDataBound(sender
As
Object
, e
As
Telerik.Web.UI.GridItemEventArgs)
Handles
RadGrid1.ItemDataBound
If
TypeOf
e.Item
Is
GridEditableItem
AndAlso
e.Item.IsInEditMode
Then
Dim
editItem
As
GridEditableItem =
DirectCast
(e.Item, GridEditableItem)
Dim
txtAction
As
TextBox =
DirectCast
(editItem(
"ColumnUniqueName"
).Controls(0), TextBox)
txtAction.TextMode = TextBoxMode.MultiLine
End
If
End
Sub
Thanks,
Princy