To display the grid column editors inline when switching grid item in edit mode (see the screenshot below), you simply need to change the MasterTableView EditMode property to InPlace.
| ASPX/ASCX |
Copy Code |
|
<rad:RadGrid id="RadGrid1" runat="server"> <MasterTableView AutoGenerateColumns="True" EditMode="InPlace" /> </rad:RadGrid> |
 |
Since version 4.0.3 Telerik RadGrid exposes MaxLength property for GridBoundColumn. Setting this property to integer value will limit the number of symbols which can be entered in the default textbox editor (when item is switched in edit mode). |
Relations between the edited item and the item in regular mode
When InPlace editing is applied, the grid row is of type GridDataItem in regular mode and GridEditableItem in edit regime. Hence you can cast the item in the ItemCreated event (for example) to those types according to its current mode:
| C# |
Copy Code |
|
private void RadGrid1_ItemCreated(object sender, Telerik.WebControls.GridItemEventArgs e) { if(e.Item is GridDataItem) { //the item is in regular mode GridDataItem dataItem = e.Item as GridDataItem; //do something here } else if (e.Item is GridEditableItem && e.Item.IsInEditMode) { //the item is in edit mode GridEditableItem editedItem = e.Item as GridEditableItem; //do something here } } |
| VB.NET |
Copy Code |
|
Private Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.WebControls.GridItemEventArgs) Handles RadGrid1.ItemCreated If (TypeOf e.Item is GridDataItem) Then
Dim dataItem As GridDataItem = CType(e.Item,GridDataItem)
ElseIf (TypeOf e.Item is GridEditableItem AndAlso e.Item.IsInEditMode) Then
Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)
End If End Sub |
Further information about how to reference controls inside grid rows/edit form you can find in this topic.