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

Hierarchy DataSource Issue

5 Answers 77 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 17 Dec 2013, 09:20 PM
Hi All,

I have an entirely code-behind C# Radgrid solution, living in SharePoint.  I have implemented a detail table within my mastertable and the hierarchy (parent-child) functionality of the grid works well.  However, this is only when I use RadGrid.DataSource = SQLDataSource.  Doing this breaks column sorting though. 

Changing my code to RadGrid.DataSourceID = SQLDataSource.ID allows me to sort the columns but breaks the hierarchy.  Does anyone have any suggestions on how to fix this?

Thanks,
Mark

5 Answers, 1 is accepted

Sort by
0
Mark
Top achievements
Rank 1
answered on 17 Dec 2013, 10:10 PM
OK, it looks like I need to create a new SQLDataSource for the DetailTable to work, but unfortunately, I'm getting a "must declare the scalar variable '@EmployeeID' for example from this link:

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

It's all code-behind. . .

Thanks,
Mark
0
Shinu
Top achievements
Rank 2
answered on 18 Dec 2013, 07:34 AM
Hi Mark,

Please make sure that you have set the DataKeyNames as EmployeeID.

ASPX:
<MasterTableView  DataKeyNames="EmployeeID">

Thanks,
Shinu
0
Mark
Top achievements
Rank 1
answered on 18 Dec 2013, 02:05 PM
Thanks Shinu!

It's all in code behind though, so it looks like this:

RadGrid.MasterTableView.DataKeyNames = new string[] {"EmployeeID"};

It still doesn't work though . . .  :-(
0
Shinu
Top achievements
Rank 2
answered on 19 Dec 2013, 03:56 AM
Hi Mark,

I couldn't replicate the issue, can you please provide your full code snippet.

Thanks,
Shinu
0
Wendy Prince
Top achievements
Rank 1
answered on 19 Dec 2013, 06:02 PM
_
Tags
Grid
Asked by
Mark
Top achievements
Rank 1
Answers by
Mark
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Wendy Prince
Top achievements
Rank 1
Share this question
or