6 Answers, 1 is accepted
0
Peter
Top achievements
Rank 1
answered on 13 Dec 2012, 02:22 AM
I've tried using client-side... but this doesn't work either...
<telerik:RadScriptBlock runat="server" ID="rsbScripts"> </telerik:RadScriptBlock>protected void rgUnits_EditCommand(object sender, GridCommandEventArgs e) { e.Item.Expanded = true; LiteralControl lc = (LiteralControl)rsbScripts.Controls[0]; lc.Text = string.Format(JSExpandRow, rgUnits.ClientID, e.Item.ItemIndex);private const string JSExpandRow = "<script type=\"text/javascript\"> " + "var grid = $find(\"{0}\"); " + "master = grid.get_masterTableView(); " + "master.expandItem({1}); " + "</script>";0
Shinu
Top achievements
Rank 2
answered on 13 Dec 2012, 04:21 AM
Hi,
Try the following code to achieve your scenario.
C#:
Thanks,
Shinu.
Try the following code to achieve your scenario.
C#:
protected void RadGrid2_ItemCommand(object sender, GridCommandEventArgs e){ if (e.CommandName == RadGrid.EditCommandName && e.Item.OwnerTableView.Name == "DetailTable1") { GridTableView childtable = (GridTableView)e.Item.OwnerTableView; foreach (GridDataItem childItem in childtable.Items) { childItem.Expanded = true; } }}Thanks,
Shinu.
0
Peter
Top achievements
Rank 1
answered on 13 Dec 2012, 04:47 AM
Thanks - but unfortunately this didn't work... it seems when the Edit User Control loads, it un-expands (or never expands).
<EditFormSettings UserControlName="~/Controls/UnitItemReplace.ascx" EditFormType="WebUserControl">0
Peter
Top achievements
Rank 1
answered on 13 Dec 2012, 04:50 AM
A similar thing happens with the client-side - it expands, but once the UserControl loads, it unexpands.
<ClientSettings> <ClientEvents OnCommand="ExpandRow" /> </ClientSettings>function ExpandRow(sender, eventArgs) { var grid = sender; var master = grid.get_masterTableView(); master.expandItem(eventArgs.get_commandArgument()); return true; }0
Accepted
Hello Peter,
Please try the following approach:
I hope this will prove helpful. Please give it a try and let me know about the result.
All the best,
Eyup
the Telerik team
Please try the following approach:
int itemIndex = -1;protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e){ if (e.CommandName == RadGrid.EditCommandName) { itemIndex = e.Item.ItemIndex; }}protected void RadGrid1_PreRender(object sender, EventArgs e){ if (itemIndex >= 0) { RadGrid1.MasterTableView.Items[itemIndex].FireCommandEvent("ExpandCollapse", String.Empty); }}I hope this will prove helpful. Please give it a try and let me know about the result.
All the best,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Peter
Top achievements
Rank 1
answered on 18 Dec 2012, 12:16 AM
That works thanks!
