Hi guys
I have a valid dataset with 3 tables that im wanting to display in my ultrawingrid. The tables are related.
Can someone please explain step for step on how to get my 3 tables to appear im my grid?
i can populate a grid with 1 table no problem.
do i have to use the ultra datasource to get this to work? if so how?
Hello Birmo,
One possible way to achieve desired behavior could be if you set Relation between tables in your DataSet. For example:
DataSet ds = new DataSet(); DataTable dt = new DataTable(); dt.Columns.Add("ID", typeof(int)); dt.Columns.Add("Col 1", typeof(string)); dt.Columns.Add("Col 2", typeof(string)); dt.Columns.Add("Col 3", typeof(int)); DataTable dt2 = new DataTable(); dt2.Columns.Add("PID", typeof(int)); dt2.Columns.Add("Col 11", typeof(string)); dt2.Columns.Add("Col 22", typeof(string)); dt2.Columns.Add("Col 33", typeof(int)); dt2.Columns.Add("Col 44", typeof(int)); ds.Tables.Add(dt); ds.Tables.Add(dt2); DataRelation dr = new DataRelation("DR", dt.Columns["ID"], dt2.Columns["PID"], true); ds.Relations.Add(dr); ultraGrid1.DataSource = ds;
DataSet ds = new DataSet();
DataTable dt = new DataTable();
dt.Columns.Add("ID", typeof(int));
dt.Columns.Add("Col 1", typeof(string));
dt.Columns.Add("Col 2", typeof(string));
dt.Columns.Add("Col 3", typeof(int));
DataTable dt2 = new DataTable();
dt2.Columns.Add("PID", typeof(int));
dt2.Columns.Add("Col 11", typeof(string));
dt2.Columns.Add("Col 22", typeof(string));
dt2.Columns.Add("Col 33", typeof(int));
dt2.Columns.Add("Col 44", typeof(int));
ds.Tables.Add(dt);
ds.Tables.Add(dt2);
DataRelation dr = new DataRelation("DR", dt.Columns["ID"], dt2.Columns["PID"], true);
ds.Relations.Add(dr);
ultraGrid1.DataSource = ds;
Please take a look at the attached sample for more details and let me know if you have any questions.
Regards ...
Hi
I just extra info.... i was geting an error of tables in grid schema must match of datasource...???
Hello Burmo,
I`m not sure what you mean with :
Burmo said:I just extra info.... i was geting an error of tables in grid schema must match of datasource...???
Did you take a look at the attached sample ? Please provide more details about your issue.
Regards
think this is a problem related to my dataset... think the third relation is not valid... thats why the schema error is happening....
thanks for the support on this oone tho...