This is a migrated thread and some comments may be shown as answers.

[Solved] Filtering of Data in NestedViewTemplate

5 Answers 212 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Peter Maslin
Top achievements
Rank 1
Peter Maslin asked on 14 May 2009, 02:52 PM
hi

i have a datagrid that uses a nested view template , and i am having trouble getting it to filter the data it displays , inside the nested view template are 2 tabs each with a data grid , and basically i want to filter the data in those grids based on the data in the main data grid.

its basic staff data , the main grid displays the core data , the tabs display role information and contact information respectively.

i am using a dataset to populate the grids , there are 3 tables in the dataset , staff data,staff roles,staff contact info , i have built all the relations , as well as following the heiracy examples , but it still wont filter the data , each table has a PersonID field in it , and i have put the ParentTableRelation in , but it wont filter , can you please offer any assistance.

5 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 18 May 2009, 12:55 PM
Hello Peter,

Thank you for the explanation. I think that you can use the following online demo of RadGrid for ASP.NET AJAX as basis for your implementation:

http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplate/defaultcs.aspx

It illustrates how to filter the data under each of the nested view template tabs based on the parent item info. You will need to modify/extend the solution to conform to your custom project schema.

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Peter Maslin
Top achievements
Rank 1
answered on 18 May 2009, 01:00 PM
i have based my version on what is in that demo .

in my version i have 2 tabs with a basic grid in each tab , i have assigned the DataKeyNames in the master table of each tab/grid , and it wont filter , is there anything else i need to assign to ensure that the tabs/grids can recieve filter information from the master grid ?

0
Sebastian
Telerik team
answered on 18 May 2009, 01:16 PM
Hi Peter,

You need to use a hidden field (label in first page view on the relevant demo) which to hold the primary key for the parent item:

<asp:Label ID="Label1" Font-Bold="true" Font-Italic="true" Text='<%# Eval("EmployeeID") %>' Visible="false" runat="server" />

and have the child grids data sources dependent on that field value (applying appropriate WHERE clause or SelectParameters to the data source controls):

Here is the corresponding part from the SqlDataSource2 definition:

<SelectParameters>
 <asp:ControlParameter ControlID="Label1" PropertyName="Text" Type="String" Name="EmployeeID" />
</SelectParameters>

Thus you should be able to filter the records in the grids successfully.

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Peter Maslin
Top achievements
Rank 1
answered on 18 May 2009, 01:21 PM
ok thanks i think i understand it now.

sorry to be a pain , but if i am using a fixed dataset , as in not a SQL one , just a constructed dataset with a few tables in it , how would i add a select clause into that dataset/datatable etc.

my data set is built from XML , and transferred into datatables to make binding etc easier.

0
Sebastian
Telerik team
answered on 18 May 2009, 01:39 PM
Hello Peter,

In this case you will need to filter the data with your custom WHERE-like clause intercepting the DetailTableDataBind event of the grid as demonstrated on this online demo of the product. The event will be fired each time when a nested table/nested view template is about to be bound to data. I hope this is feasible solution for your situation.

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Peter Maslin
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Peter Maslin
Top achievements
Rank 1
Share this question
or