I want to programmatically tell the grid when to show the [+] hierarchy expand button. Can this be done or do all the rows have to have this enabled?
I have a databound master and a load-on-demand child. My problem is that not all rows make sense to have this template shown. Below is how I am approaching this now.
GridViewTemplate template = new GridViewTemplate();
template.Columns.Add(new GridViewTextBoxColumn("Account"));
template.Columns.Add(new GridViewTextBoxColumn("CRM Opp ID"));
gvAttainment.MasterTemplate.Templates.Add(template);
template.HierarchyDataProvider = new GridViewEventDataProvider(template);
this.gvAttainment.RowSourceNeeded += new GridViewRowSourceNeededEventHandler(gvAttainment_RowSourceNeeded);
...
void gvAttainment_RowSourceNeeded(object sender, GridViewRowSourceNeededEventArgs e)
{
switch (e.ParentRow.HierarchyLevel)
{
case 0:
//Query DB for data and display here
GridViewRowInfo row = e.Template.Rows.NewRow();
row.Cells["Account"].Value = from DB
I have a databound master and a load-on-demand child. My problem is that not all rows make sense to have this template shown. Below is how I am approaching this now.
GridViewTemplate template = new GridViewTemplate();
template.Columns.Add(new GridViewTextBoxColumn("Account"));
template.Columns.Add(new GridViewTextBoxColumn("CRM Opp ID"));
gvAttainment.MasterTemplate.Templates.Add(template);
template.HierarchyDataProvider = new GridViewEventDataProvider(template);
this.gvAttainment.RowSourceNeeded += new GridViewRowSourceNeededEventHandler(gvAttainment_RowSourceNeeded);
...
void gvAttainment_RowSourceNeeded(object sender, GridViewRowSourceNeededEventArgs e)
{
switch (e.ParentRow.HierarchyLevel)
{
case 0:
//Query DB for data and display here
GridViewRowInfo row = e.Template.Rows.NewRow();
row.Cells["Account"].Value = from DB