Hi team,
Can u pls suggest me some sample to programatically create nested gridview with relations
var qry1 = (from p in obaData.tblProjects |
select p); |
this.DemoGridView.ItemsSource = qry1.ToList(); |
tblProject project = new tblProject(); |
GridViewTableDefinition d = new GridViewTableDefinition(); |
var qry2 = (from r in obaData.tblTasks |
select r); |
d.Relation = new Telerik.Windows.Data.PropertyRelation("projectId"); |
d.DataSource = qry2.ToList(); |
d.IsReadOnly = true; |
this.DemoGridView.ChildTableDefinitions.Add(d); |
Or tell me whats wrong with the above code,
using this code, child table records are not avaiable
6 Answers, 1 is accepted
0
Hello Shanthi Gangatharan,
Sincerely yours,
Milan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Could you please take a look at our "Custom Hierarchy" online example or check out our help topics which can offer more detailed information about displaying hierarchical data.
Sincerely yours,
Milan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
shadhan
Top achievements
Rank 1
answered on 15 Dec 2009, 01:07 PM
Hi Milan ,
yes, i looked into that
Can u please give me some sample using linq to sql based coded nested gridview (programatically)
0
shadhan
Top achievements
Rank 1
answered on 16 Dec 2009, 07:38 AM
Hi Milan,
I tried some sample code from documentation
below is the code
When i press + symbol the parent table records repeated in child grid also
can u pls help me to finish this issue
DataSet dataSet = data.GetData(); |
DataRelation drelation = new DataRelation("project_to_task", dataSet.Tables[0].Columns["projectId"], dataSet.Tables[1].Columns["projectId"]); |
drelation.Nested = true; |
dataSet.Relations.Add(drelation); |
radGridView1.ItemsSource = dataSet; |
radGridView1.DataMember = dataSet.Tables["tblProjects"].TableName; |
GridViewTableDefinition definition = new GridViewTableDefinition(); |
definition.AutoGenerateFieldDescriptors = true; |
definition.DataSource = dataSet.Tables["tblTasks"]; |
GridViewDataColumn project = new GridViewDataColumn(); |
project.UniqueName = "ProjectId"; |
//order.HeaderText = "ProjectId"; |
project.DataType = typeof(int); |
GridViewDataColumn tasks = new GridViewDataColumn(); |
tasks.UniqueName = "taskId"; |
//product.HeaderText = "taskId"; |
tasks.DataType = typeof(int); |
TableRelation relation = new TableRelation(); |
FieldDescriptorNamePair fdpair = new FieldDescriptorNamePair(); |
fdpair.ChildFieldDescriptorName = "projectId"; |
fdpair.ParentFieldDescriptorName = "projectId"; |
relation.FieldNames.Add(fdpair); |
definition.FieldDescriptors.Add(project); |
definition.FieldDescriptors.Add(tasks); |
radGridView1.TableDefinition.ChildTableDefinitions.Add(definition); |
0
shadhan
Top achievements
Rank 1
answered on 16 Dec 2009, 08:28 AM
I think the problem is in defining relationship
any suggestions or anything wrong i did
any suggestions or anything wrong i did
0
Accepted
Hello Shanthi Gangatharan,
Sincerely yours,
Milan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Here is a sample application that demonstrates how you can create a hierarchy when using DataSet.
Sincerely yours,
Milan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
shadhan
Top achievements
Rank 1
answered on 18 Dec 2009, 12:44 PM
Hi Milan ,
Thanks for your attachment
Its looking good for beginners,
My problem has been solved and its working good.
Thanks & Regards
Shanthi
Thanks for your attachment
Its looking good for beginners,
My problem has been solved and its working good.
Thanks & Regards
Shanthi