I have a rad grid with a master (parent) and detailtable (child).
And I tried an example that was posted on another thread, but no matter what I try, I can't get get_nestedViews to work. It always returns error "Object doesn't support this property or method"
Here's the sample I tried....
the aspx..
C#
This seemed so simple, but I can't get it to work.
Please help as I'm trying to access the nested/child tables via JavaScript in order to select the child rows when the parent row is selected. I have everything else working -- I have the selection/deselection of the parent row wired to a javascript function, I force teh parent row to be expanded if it isn't already -- I just can't seem to access the child/nested table to select all of its rows.
Thanks!
- Debbie
And I tried an example that was posted on another thread, but no matter what I try, I can't get get_nestedViews to work. It always returns error "Object doesn't support this property or method"
Here's the sample I tried....
the aspx..
| <script type="text/javascript" language="javascript"> |
| function getNestedViewsForFirstMasterItem() { |
| debugger; |
| var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView(); |
| alert(masterTable.get_dataItems()[0].get_nestedViews().length); |
| } |
| </script> |
| <asp:Button ID="Button1" runat="server" Text="GetNested" OnClientClick="getNestedViewsForFirstMasterItem();return false;" /> |
| <telerik:RadGrid ID="RadGrid1" GridLines="None" runat="server" OnNeedDataSource="radgrid1_NeedDataSource"> |
| <MasterTableView DataKeyNames="ID" Width="100%"> |
| <DetailTables> |
| <telerik:GridTableView DataKeyNames="ID" /> |
| </DetailTables> |
| </MasterTableView> |
| </telerik:RadGrid> |
C#
| protected void radgrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e) |
| { |
| var dt = new DataTable(); |
| dt.Columns.Add("ID", typeof(Int32)); |
| dt.Columns.Add("Name", typeof(String)); |
| dt.Rows.Add(1, "test"); |
| dt.Rows.Add(2, "Another test"); |
| RadGrid1.DataSource = dt; |
| } |
This seemed so simple, but I can't get it to work.
Please help as I'm trying to access the nested/child tables via JavaScript in order to select the child rows when the parent row is selected. I have everything else working -- I have the selection/deselection of the parent row wired to a javascript function, I force teh parent row to be expanded if it isn't already -- I just can't seem to access the child/nested table to select all of its rows.
Thanks!
- Debbie