Hi
Users of my app some time ago reported issue with memory leak, so I started investigation and it looks that there is problem with RadGridView.
This is my sample code:
public partial class Form1 : Form { BindingList<Package> _packages = new BindingList<Package>(); BindingList<PackageItem> _items = new BindingList<PackageItem>(); public Form1() { InitializeComponent(); radGridView1.DataSource = _packages; radGridView1.ReadOnly = true;
GridViewTemplate viewItemsTemplate = new GridViewTemplate(); viewItemsTemplate.DataSource = _items; this.radGridView1.MasterTemplate.Templates.Add(viewItemsTemplate);
GridViewRelation relation = new GridViewRelation(radGridView1.MasterTemplate); relation.RelationName = "myRelation"; relation.ChildTemplate = viewItemsTemplate;
relation.ParentColumnNames.Add("Id"); relation.ChildColumnNames.Add("PackageId");
this.radGridView1.Relations.Add(relation); _packages.Add(new Package() { Id = "1", Name = "Package1" }); _items.Add(new PackageItem() { Id = "1", PackageId = "1", Name = "Item1 in package1" }); _items.Add(new PackageItem() { Id = "2", PackageId = "1", Name = "Item2 in package1" }); _packages.Add(new Package() { Id = "2", Name = "Package2" }); _items.Add(new PackageItem() { Id = "3", PackageId = "2", Name = "Item1 in package2" }); _items.Add(new PackageItem() { Id = "4", PackageId = "2", Name = "Item2 in package2" }); radGridView1.BestFitColumns(); } private void btnDelete_Click(object sender, EventArgs e) { radGridView1.BeginUpdate(); PackageItem pi = _items[0]; _items.Remove(pi); radGridView1.EndUpdate(); } }
When I delete row I call BeingUpdate() and EndUpdate(), this is needed – without these calls row is not deleted and after click on row exception is thrown.
TO SEE this problem before deleting row YOU HAVE TO expand child rows!
I used profiler and I have seen that there are types that hook this event and do not unhook after disposing! These types are: GridDetailViewCellElement, GridDetailViewRowElement, GridTableElement. You can check details in screen shots.
How can I solve this problem? This is really urgent issue for me – I have a lot of updates in my grid and after couple hours there is always out of memory exception caused by my app.
Regards
this.rScheduler.GetTimelineView().StartDate = DateTime.Today;
this.rScheduler.GetTimelineView().RangeStartDate = DateTime.Today.AddYears(-1);
this.rScheduler.GetTimelineView().RangeEndDate = DateTime.Today.AddYears(1);
If I change the first statement to: this.rScheduler.GetTimelineView().StartDate = new DateTime(2010, 11, 20);
this sets the default date on the Timeline View to this date correctly when the TimelineView is shown.
Any date after 31st Dec 2010 sets the Time Line View Start date to 31st Dec 2010.
Thanks,
Lester


