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

EnableAlternatingRowColor property different for master/child possible?

2 Answers 7 Views
GridView
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 1
George asked on 23 May 2015, 04:59 PM

Hi,

I have set the EnableAlternatingRowColor property in my master template to true, and to false for the gid child template. However its seems the grid obeys only the master template setting across all children templates.

 

Is it possible to set a child template EnableAlternatingRowColor property different from the master template at all?

 

Regards,

 George

2 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 25 May 2015, 12:05 PM
Hello George,

Thank you for writing.

The EnableAlternatingRowColor property gets or sets a value indicating whether alternating row color is enabled for the specific GridViewTemplate. You can set it to true for the MasterTemplate and set it to false for the child template:
private void Form1_Load(object sender, EventArgs e)
{
    this.suppliersTableAdapter.Fill(this.nwindDataSet.Suppliers);
    this.productsTableAdapter.Fill(this.nwindDataSet.Products);
 
    radGridView1.DataSource = nwindDataSet.Suppliers;
    radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
     
    GridViewTemplate template = new GridViewTemplate();
    template.DataSource = nwindDataSet.Products;
    template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
    radGridView1.MasterTemplate.Templates.Add(template);
 
    GridViewRelation relation = new GridViewRelation(radGridView1.MasterTemplate);
    relation.ChildTemplate = template;
    relation.RelationName = "SuppliersProducts";
    relation.ParentColumnNames.Add("SupplierID");
    relation.ChildColumnNames.Add("SupplierID");
    radGridView1.Relations.Add(relation);
 
    this.radGridView1.MasterTemplate.EnableAlternatingRowColor = true;
    this.radGridView1.TableElement.AlternatingRowColor = Color.LimeGreen;
    template.EnableAlternatingRowColor = false;
}

The attached screenshot illustrates the result on my end. Could you please specify how the above code snippet differs from the grid set up on your end in order to replicate the described problem? Once, we reproduce the issue, we can make adequate analysis of the problem and assist you further. Thank you in advance. 

I am looking forward to your reply.

Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
George
Top achievements
Rank 1
answered on 25 May 2015, 02:43 PM

Thank you, works just fine now.

 

Regards,

 

George

Tags
GridView
Asked by
George
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
George
Top achievements
Rank 1
Share this question
or