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

how to set NestedViewSettings DataSourceID in code behind

3 Answers 166 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dhamodharan
Top achievements
Rank 1
Dhamodharan asked on 27 Dec 2012, 03:21 PM
Hi All,

I am using Radgrid into NestedViewTemplate(Hierarchy Grid). i want to add datasourceid in code behind. i have write code in parent grid itemDataBound like this

 If TypeOf e.Item Is GridNestedViewItem Then
            Dim nesItem As GridNestedViewItem = DirectCast(e.Item, GridNestedViewItem)
            Dim rgQuesSection As RadGrid = DirectCast(nesItem.FindControl("rgQuesSection"), RadGrid)
            Dim rgQuesPanel As RadGrid = DirectCast(nesItem.FindControl("rgQuesPanel"), RadGrid)
            Dim nestedView As GridNestedViewSettings
            nestedView.DataSource = "sdsQuesSection"
            nesItem.Controls.Add(nestedView )
        End If

But GridNestedViewSettings come like nothing. Please let me know how to solve.

Thanks in Advance,
Dhamu.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Dec 2012, 05:07 AM
Hi,

Try populating the grid in ItemCreated event. Hope this helps.

Thanks,
Shinu.
0
Dhamodharan
Top achievements
Rank 1
answered on 28 Dec 2012, 05:50 AM
Hi Shinu,

It is not working. i want to set GridNestedViewSettings datasourceId and add to Parent grid. is this possible in code behind?



Thanks,
Dhamu
0
Shinu
Top achievements
Rank 2
answered on 03 Jan 2013, 06:45 AM
Hi,

I was able to bind the inner grid in ItemCreated event without using GridNestedViewSettings. One suggestion is  that you can bind the inner grids through its NeedDataSource event.In the NeedDataSource event, you can get reference to the outer grid expanded item, e.g. the parent item. Thus you can get a data field value of the expanded item and use it for retrieving the inner grid data source.

Thanks,
Shinu.
Tags
Grid
Asked by
Dhamodharan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Dhamodharan
Top achievements
Rank 1
Share this question
or