Hello,
I have hierarchical Grid with two details tables at the same level. Everything works OK. But I need to select only one detail at a time. Is there any possibilty how to make more expand buttons, each for only one detail table?
Than you for help.
Michal
I have hierarchical Grid with two details tables at the same level. Everything works OK. But I need to select only one detail at a time. Is there any possibilty how to make more expand buttons, each for only one detail table?
Than you for help.
Michal
4 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 24 Mar 2009, 04:40 AM
Hi Michal,
You can set the Name property of the Detail table ,check it from the client side and make it selectable accordingly.
ASPX:
JS:
Thanks
Shinu.
You can set the Name property of the Detail table ,check it from the client side and make it selectable accordingly.
ASPX:
<DetailTables> |
<telerik:GridTableView |
DataSourceID="AccessDataSource1" |
Width="100%" |
Name="Detail1"> |
........ |
</telerik:GridTableView> |
</DetailTables> |
<DetailTables> |
<telerik:GridTableView |
DataSourceID="AccessDataSource2" |
Width="100%" |
Name="Detail2"> |
........ |
</telerik:GridTableView> |
</DetailTables> |
JS:
<script type="text/javascript"> |
function RowSelecting(sender, eventArgs) |
{ |
//eventArgs.get_tableView() returns the gridtable |
//from which the event originated |
if(eventArgs.get_tableView().get_name()!="Detail2") |
{ |
eventArgs.set_cancel(true); |
} |
} |
</script> |
Thanks
Shinu.
0
Michal
Top achievements
Rank 1
answered on 24 Mar 2009, 02:37 PM
Hi Shinu,
thanks for help.
I ment a different scenario.
There were two detail tables on the second level. In master view there were two expand buttons for openning only one detail table out of these two. That means, I need to select only part of a detail at a time.
Thans for your help
Michal
thanks for help.
I ment a different scenario.
There were two detail tables on the second level. In master view there were two expand buttons for openning only one detail table out of these two. That means, I need to select only part of a detail at a time.
Thans for your help
Michal
0
Princy
Top achievements
Rank 2
answered on 25 Mar 2009, 05:40 AM
Hello Michal,
You can try out the example below with which I implemented a similar scenario as yours. In the example given, I use LinkButtons in TemplateColumns and set the visbility of the GridTableViews based on the click of the linkbuttons:
aspx:
cs:
Thanks
Princy.
You can try out the example below with which I implemented a similar scenario as yours. In the example given, I use LinkButtons in TemplateColumns and set the visbility of the GridTableViews based on the click of the linkbuttons:
aspx:
<telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" runat="server" AutoGenerateColumns="true" > |
<MasterTableView CommandItemDisplay="Top" EditMode="InPlace" DataSourceID="SqlDataSource1"> |
<DetailTables> |
<telerik:GridTableView AutoGenerateColumns="true" DataSourceID="SqlDataSource2" EditMode="InPlace" Name="Detail1" CommandItemDisplay="Bottom" runat="server" > |
</telerik:GridTableView> |
<telerik:GridTableView DataSourceID="SqlDataSource3" AutoGenerateColumns="true" EditMode="InPlace" CommandItemDisplay="Top" Name="Detail2" runat="server" > |
</telerik:GridTableView> |
</DetailTables> |
<Columns> |
<telerik:GridTemplateColumn UniqueName="Template1"> |
<ItemTemplate> |
<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click1" >ExpandGridTableView1</asp:LinkButton> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridTemplateColumn UniqueName="Template2"> |
<ItemTemplate> |
<asp:LinkButton ID="LinkButton2" runat="server" OnClick="LinkButton2_Click" >ExpandGridTableView2</asp:LinkButton> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
.... |
</Columns> |
..... |
cs:
protected void LinkButton1_Click1(object sender, EventArgs e) |
{ |
LinkButton linkbutton1 = (LinkButton)sender; |
GridDataItem dataItem = (GridDataItem)linkbutton1.NamingContainer; |
dataItem.Expanded = !dataItem.Expanded; |
if (dataItem.Expanded) |
{ |
GridTableView nestedView = (GridTableView)dataItem.ChildItem.NestedTableViews[0]; |
nestedView.Visible = true; |
GridTableView nestedView1 = (GridTableView)dataItem.ChildItem.NestedTableViews[1]; |
nestedView1.Visible = false; |
} |
} |
protected void LinkButton2_Click(object sender, EventArgs e) |
{ |
LinkButton linkbutton2 = (LinkButton)sender; |
GridDataItem dataItem = (GridDataItem)linkbutton2.NamingContainer; |
dataItem.Expanded = !dataItem.Expanded; |
if (dataItem.Expanded) |
{ |
GridTableView nestedView = (GridTableView)dataItem.ChildItem.NestedTableViews[0]; |
nestedView.Visible = false; |
GridTableView nestedView1 = (GridTableView)dataItem.ChildItem.NestedTableViews[1]; |
nestedView1.Visible = true; |
} |
} |
Thanks
Princy.
0
Michal
Top achievements
Rank 1
answered on 25 Mar 2009, 12:59 PM
Princy,
that's EXACTLY what I needed.
Thank you for help.
Michal
that's EXACTLY what I needed.
Thank you for help.
Michal