New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
Hide All Rows on Edit and Display the Edit Form Only
When the grid presentation area is restricted on your page you may not want to display the rest of the grid items on item editing (as thus the control will expand its height). To hide all rows in Telerik RadGrid on item editing and display merely the edit form for the editing item (along with that item), you need to:
-
Subscribe to the PreRender event of Telerik RadGrid
-
Verify whether RadGrid1.EditItems.Count is greater than 0
-
Traverse all grid items which differ from the item in the RadGrid1.EditItems collection and set their Visible attribute to False
After update/cancel operation, the rest of the grid records will show up on the page.
ASP.NET
<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" runat="server">
<MasterTableView AutoGenerateColumns="True">
<Columns>
<telerik:GridEditCommandColumn UniqueName="EditCommandColumn" />
</Columns>
</MasterTableView>
</telerik:RadGrid>