When using the GroupsDefaultExpanded = False, and also using inline editing, when I click the editbutton, my inline edit form won't show but instead the group collapses again. When using groups and not having GroupsDefaultExpanded on false there is no problem.
Using 2008.3.1124, in a dotNetNuke module. But also tried a testpage without dotnetnuke with the same problem.
Using 2008.3.1124, in a dotNetNuke module. But also tried a testpage without dotnetnuke with the same problem.
8 Answers, 1 is accepted
0
Hello Steven,
This is the default behavior of the GroupsDefaultExpanded property when it's set to False. In order to be able to open the InPlace edit mode in this scenario I suggest you set GroupLoadMode to "Client".
Actually, it's possible to implement this functionality in your project. A sample code is shown below:
Let us know if you need more information.
Best regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
This is the default behavior of the GroupsDefaultExpanded property when it's set to False. In order to be able to open the InPlace edit mode in this scenario I suggest you set GroupLoadMode to "Client".
Actually, it's possible to implement this functionality in your project. A sample code is shown below:
protected void RadGrid1_PreRender(object sender, EventArgs e) |
{ |
if (!string.IsNullOrEmpty(group)) |
{ |
GridItem[] items = RadGrid1.MasterTableView.GetItems(GridItemType.GroupHeader); |
foreach (GridGroupHeaderItem item in items) |
if (item.GroupIndex == group) |
item.Expanded = true; |
} |
} |
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) |
{ |
if (e.CommandName == RadGrid.EditCommandName) |
group = e.Item.GroupIndex.Substring(0, e.Item.GroupIndex.LastIndexOf("_")); |
} |
<MasterTableView AutoGenerateColumns="false" CommandItemDisplay="Top" GroupsDefaultExpanded="false" |
GroupLoadMode="Client" EditMode="InPlace"> |
Let us know if you need more information.
Best regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

Steven
Top achievements
Rank 2
answered on 18 Dec 2008, 11:20 AM
Thanks alot for the sample.
Where does the "group" var come from?
Where does the "group" var come from?
0
Accepted
Hello Steven,
Actually there is an error in the example (I omit a mandatory check -> RadGrid1.MasterTableView.GroupByExpressions.Count > 0).
Please find the modified version below:
Best regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Actually there is an error in the example (I omit a mandatory check -> RadGrid1.MasterTableView.GroupByExpressions.Count > 0).
Please find the modified version below:
string group = string.Empty; |
protected void RadGrid1_PreRender(object sender, EventArgs e) |
{ |
if (!string.IsNullOrEmpty(group)) |
{ |
GridItem[] items = RadGrid1.MasterTableView.GetItems(GridItemType.GroupHeader); |
foreach (GridGroupHeaderItem item in items) |
if (item.GroupIndex == group) |
item.Expanded = true; |
} |
} |
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) |
{ |
if (e.CommandName == RadGrid.EditCommandName && RadGrid1.MasterTableView.GroupByExpressions.Count > 0) |
group = e.Item.GroupIndex.Substring(0, e.Item.GroupIndex.LastIndexOf("_")); |
} |
Best regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

Steven
Top achievements
Rank 2
answered on 18 Dec 2008, 11:49 AM
Thanks alot Daniel! Works like a charm.
0

Mike Conine
Top achievements
Rank 1
answered on 31 Dec 2008, 10:38 PM
Hello;
I cannot seem to get this example to function do you have a full code set page and code behind, prefferably vb.
I cannot seem to get this example to function do you have a full code set page and code behind, prefferably vb.
0

Shinu
Top achievements
Rank 2
answered on 02 Jan 2009, 07:43 AM
Hi Mike,
Here is the code in VB:
ASPX:
Thanks
Shinu
Here is the code in VB:
Private group As String = String.Empty |
Protected Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As EventArgs) |
If Not String.IsNullOrEmpty(group) Then |
Dim items As GridItem() = RadGrid1.MasterTableView.GetItems(GridItemType.GroupHeader) |
For Each item As GridGroupHeaderItem In items |
If item.GroupIndex = group Then |
item.Expanded = True |
End If |
Next |
End If |
End Sub |
Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) |
If e.CommandName = RadGrid.EditCommandName AndAlso RadGrid1.MasterTableView.GroupByExpressions.Count > 0 Then |
group = e.Item.GroupIndex.Substring(0, e.Item.GroupIndex.LastIndexOf("_")) |
End If |
End Sub |
ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" OnPreRender="RadGrid1_PreRender" OnItemCommand="RadGrid1_ItemCommand" GridLines="None" > |
<MasterTableView EditMode="inPlace" GroupsDefaultExpanded="false" DataSourceID="SqlDataSource1" > |
<GroupByExpressions> |
<telerik:GridGroupByExpression> |
<GroupByFields> |
<telerik:GridGroupByField FieldAlias="SupplierID" FieldName="SupplierID" /> |
</GroupByFields> |
<SelectFields> |
<telerik:GridGroupByField FieldAlias="SupplierID" FieldName="SupplierID" /> |
</SelectFields> |
</telerik:GridGroupByExpression> |
</GroupByExpressions> |
<Columns> |
<telerik:GridBoundColumn DataField="ProductName" UniqueName="ProductName"></telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="SupplierID" UniqueName="SupplierID"></telerik:GridBoundColumn> |
<telerik:GridEditCommandColumn></telerik:GridEditCommandColumn> |
</Columns> |
</MasterTableView> |
</telerik:RadGrid> |
</div> |
</form> |
</body> |
</html> |
Thanks
Shinu
0

Peichung
Top achievements
Rank 1
answered on 20 Apr 2009, 07:18 PM
I have the same problem with EditMode="EditForms", and the suggested codes work for me. However, when I have more than one item from the same group that are in the edit mode, updating or canceling the edit for one item will collapse the group. I would like to keep the group expanded since there are other items in the edit mode. To accomplish this, I tried to keep tracking which group index should be expanded by doing:
but then I realized that e.Item.GroupIndex is not available when e.CommandName == RadGrid.CancelCommandName. Is there any way I can make it work? Thanks,
Peichung
protected void Grid1_ItemCommand(object source, GridCommandEventArgs e) |
{ |
if (e.CommandName == RadGrid.EditCommandName && Grid1.MasterTableView.GroupByExpressions.Count > 0) |
{ |
AddExpandedGroupIndex(e.Item.GroupIndex.Substring(0, e.Item.GroupIndex.LastIndexOf("_"))); |
} |
if (e.CommandName == RadGrid.CancelCommandName && Grid1.MasterTableView.GroupByExpressions.Count > 0) |
{ |
RemoveExpandedGroupIndex(e.Item.GroupIndex.Substring(0, e.Item.GroupIndex.LastIndexOf("_"))); |
} |
} |
but then I realized that e.Item.GroupIndex is not available when e.CommandName == RadGrid.CancelCommandName. Is there any way I can make it work? Thanks,
Peichung
0

G
Top achievements
Rank 1
answered on 31 Dec 2010, 09:03 AM
Hi Shinu
i'm having this same problem with the Edit but in a detail table. the code does not work for the detail table.
can you explain how the expand collapse function works.
i tried this in the RadGrid_Prerender Sub but it is not working ? i don't understand why...
thanks...
i'm having this same problem with the Edit but in a detail table. the code does not work for the detail table.
can you explain how the expand collapse function works.
i tried this in the RadGrid_Prerender Sub but it is not working ? i don't understand why...
Dim
item
As
GridItem
For
Each
item
In
RadGrid1.MasterTableView.DetailTables.Item(0).Controls
If
TypeOf
item
Is
GridGroupHeaderItem
Then
If
item.IsInEditMode
Then
item.Expanded =
True
Else
item.Expanded =
False
End
If
End
If
Next
item
thanks...