Hi,
Need a suggestion to bind hierarchical win grid data from list at runtime only for exporting to excel.
Infragistics version we are using is 13.1
Thank in advance.Any help would be highly appreciated with a working example.
Hello ,
You should structure your classes hierarchy like:
private void Form1_Load(object sender, EventArgs e) { A a = new A {Id = 1}; B b = new B {Name = "b1", ParId = 1}; a.Coll = new BindingList<B>{b}; ultraGrid1.DataSource = new BindingList<A> { a }; B b2 =new B{Name = "b2", ParId = 1}; B b3 = new B { Name = "b3", ParId = 1 }; a.Coll.Add(b2); a.Coll.Add(b3); } public class B { public int ParId { get; set; } public string Name { get; set; } } public class A { public int Id { get; set; } public BindingList<B> Coll { get; set; } }
Please let me know if you have any further questions.
Hi Thanks for the prompt reply,
the grid is getting binded I can see the data source is assigned but we are not able to export this at runtime.
Need a code where we can export this runtime binded grid in excel export.
Are you creating the grid at run-time in code? If so, make sure you add the grid to the form's Controls collection. If you don't do that, the grid will not have any context for binding and it will not be able to get any data from the data source.
As an added benefit, the form will also handle disposing the control when the form is disposed.
Hello,
I am just checking about the progress of this issue. Let me know If you need our further assistance on this matter ?
Thank you for using Infragistics Components.