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

get data from gridview in HierarchyChildTemplate

3 Answers 111 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Sam Ur
Top achievements
Rank 2
Sam Ur asked on 24 Sep 2010, 01:11 PM
Hi,
I have created a RadGridView with HierarchyChildTemplate, this template contains DataTemplate which contains RadGridView.
I was wondering how can i get to this RadGridView (inside my template) from code, because I would like to get all selected items in this RadGridView.

3 Answers, 1 is accepted

Sort by
0
Accepted
Veselin Vasilev
Telerik team
answered on 24 Sep 2010, 01:16 PM
Hi Sam Ur,

I believe that this how-to article will help you:
How-to: Set properties to the child gridview

Kind regards,
Veselin Vasilev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Sam Ur
Top achievements
Rank 2
answered on 24 Sep 2010, 02:31 PM
Well I don't know, what i want is the followning scenario:
 I have already loaded data Hierarchicly - now i have like categories and when i expand them (one, two, etc.) i have a radgridview with subcategories which i load using RadGridView.HierarchyChildTemplate.
Now I can select this subcategories and as a final result i would like to get selected subcategories for every category.

I thought i might solve this by looping through all my main items (categories) and then for each category (item in my "main grid") i would sort of get (do not know how) - a radgridview with selected items.

So if i have something like....

[+] Category one -- i expand this row in my grid i see my sub categories ....
    [ check ] Sub Category 1
    [ check ] Sub Category 2
    [ ] Sub Category 3    
    [ ] Sub Category 4

Now if i select only Sub Category 1 and Sub Category 2 ... i would somehow like tho get only this items (?)

Maybe I should use different approach.
Maybe I should use a hook on selection change and monitor items aded or items removed values and based on that fill my list of selected subcategories (?)

Thnx for your help.
0
Sam Ur
Top achievements
Rank 2
answered on 27 Sep 2010, 09:44 AM
Solved my issue...basically I helped myself with Selection changed event...and then used 
...
var senderElement = e.OriginalSource as FrameworkElement;
var rowType = ((RadGridView) senderElement).SelectedItem.GetType();
...
and based on this implemented my logic :-)
Tags
GridView
Asked by
Sam Ur
Top achievements
Rank 2
Answers by
Veselin Vasilev
Telerik team
Sam Ur
Top achievements
Rank 2
Share this question
or