Bindinglist.Insert
hi,
I created class and using grid1.DataSource = myBindingList;
I'm using the one myBindlist.Add(newfeed) is okay.
There is a problem when I want to insert myBindinglist.Insert(0,newfeed);
Grid is displaying both 0 index and at the end of the grid for this newwfeed although the myBindingList count is correct.
I can get the right display everytime i am using mybindinglist.insert(0,newfeed) and follow by myBindinglist.ResetBinding()
Thanks for your support!!.
-
Hello,
Binding lists indexing may not match the indexing grid. For this there are many reasons. Binding lists don’t support filtering, hierarchy, grouping etc. Also the same binding list can be connected to different grids having different filtering, sorting, grouping... Therefore adding data to the beginning or to the end of the binding list will get the same result. The easiest solution to display latest news in first rows is to sort them by time (you can hide this column if you want). The second solution – subscribe for Grid.RowAdded event and set Row.ChildIndex to zero:
grid.RowAdded += delegate(object sender, GridRowEventArgs e)
{
e.Row. ChildIndex = 0;
};For performance reasons add data to the end of the BindingList.
Best regards,
Dapfor0
Please sign in to leave a comment.
Comments
1 comment