hello everyone..
am using telerik radGridView for windows forms. I need to have atleast of 3 levels of hierarchy in my grid. And, it is essential for me to follow "Load-on-Demand" method to bind the inner grids.
Currently am doing this:
private void Form2_Load(object sender, EventArgs e)
{
this.radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
//First Child Template Begins
GridViewTemplate firstLevelTemplate = new GridViewTemplate();
firstLevelTemplate.Columns.Add("Name", "Name", "Name");
firstLevelTemplate.Columns.Add("Owner", "Owner", "Owner");
firstLevelTemplate.Columns.Add("Parent", "Parent", "Parent");
//First Child Template Ends
this.radGridView1.Templates.Add(firstLevelTemplate);
this.radGridView1.Templates[0].HierarchyDataProvider = new GridViewEventDataProvider(firstLevelTemplate);
this.radGridView1.RowSourceNeeded += new GridViewRowSourceNeededEventHandler(radGridView1_RowSourceNeeded);
}
void radGridView1_RowSourceNeeded(object sender, GridViewRowSourceNeededEventArgs e)
{
string serverInstance = e.ParentRow.Cells[0].Value.ToString();
ServerConnection conn = new ServerConnection();
conn.ServerInstance = serverInstance;
Server srv = new Server(conn);
DatabaseCollection DBs = srv.Databases;
foreach (Database db in DBs)
{
GridViewRowInfo row = e.Template.Rows.NewRow();
row.Cells[0].Value = db.Name;
row.Cells[1].Value = db.Owner;
row.Cells[2].Value = db.Parent.Name;
e.SourceCollection.Add(row);
}
}
It beautifully adds the two levels! I want a third level now. How to do that?? I tried adding GridViewTemplate to e.Template.Templates, but no luck..please help me..
am using telerik radGridView for windows forms. I need to have atleast of 3 levels of hierarchy in my grid. And, it is essential for me to follow "Load-on-Demand" method to bind the inner grids.
Currently am doing this:
private void Form2_Load(object sender, EventArgs e)
{
this.radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
//First Child Template Begins
GridViewTemplate firstLevelTemplate = new GridViewTemplate();
firstLevelTemplate.Columns.Add("Name", "Name", "Name");
firstLevelTemplate.Columns.Add("Owner", "Owner", "Owner");
firstLevelTemplate.Columns.Add("Parent", "Parent", "Parent");
//First Child Template Ends
this.radGridView1.Templates.Add(firstLevelTemplate);
this.radGridView1.Templates[0].HierarchyDataProvider = new GridViewEventDataProvider(firstLevelTemplate);
this.radGridView1.RowSourceNeeded += new GridViewRowSourceNeededEventHandler(radGridView1_RowSourceNeeded);
}
void radGridView1_RowSourceNeeded(object sender, GridViewRowSourceNeededEventArgs e)
{
string serverInstance = e.ParentRow.Cells[0].Value.ToString();
ServerConnection conn = new ServerConnection();
conn.ServerInstance = serverInstance;
Server srv = new Server(conn);
DatabaseCollection DBs = srv.Databases;
foreach (Database db in DBs)
{
GridViewRowInfo row = e.Template.Rows.NewRow();
row.Cells[0].Value = db.Name;
row.Cells[1].Value = db.Owner;
row.Cells[2].Value = db.Parent.Name;
e.SourceCollection.Add(row);
}
}
It beautifully adds the two levels! I want a third level now. How to do that?? I tried adding GridViewTemplate to e.Template.Templates, but no luck..please help me..