Home Forums WinForms controls Xceed Grid for WinForms Resulting empty grid when changing DataSource.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #16091 |

    Hi there,

    Searching for a solution to my problem I found a topic refering exacly to it.
    Sadly, the discussion wasn’t completed. (http://xceed.com/CS/forums/thread/3208.aspx)

    Well, first the context:
    – Drawing my grids is taking too long, this way I’m researching a way to reuse already drawn grids. What I though about is that changing the DataSource would be much quicker than redrawing everything. (Is this correct? I don’t really know… I was going to test and see what happends)

    Theoreticall Explanation:
    1) If it is the first time the grid is drawn.. it does everything correcly and shows everything the way it should be.

    2) If it is not the first time, and the last grid can be reused (the parameters that are involved with the grid display are the same), just change de datasource. (problem occurs)

    Code:
                //Copys the last grid
                Agrid = (GridControl) gridLastGrid.Clone();

                //Modify the grid
                Agrid.BeginInit();

                //Agrid.SetDataBinding((DataSet) AdsData, “Resumes”); <- Solution from the topic I referred (didn’t work)

                Agrid.DataSource = AdsData;

                Agrid.EndInit();
               
               //Updates last grid
                gridLastGrid = (GridControl) Agrid.Clone();

    In the topic I referred to, CharlesB points that the problem could be the DataMember not being set up. Well, since Agrid receives a copy from gridLastGrid (that shows up correctly) it should work fine (DataMember from Agrid is set, I saw it in debug mode)

    The problem:

    Agrid receives DataRows from gridLastGrid (2datarows), but when I change the datasource, the number of datarows is set to zero.
    I expected that the number of datarows would be updated with the EndInit()… but that won’t happen, and that’s my problem.

    Ps. AdsData is exacly the same from the first time drawn grid. I’m using the same to test my code.

    Anyone got any ideas on how to solve this?

    Thanks in advance.
    Oscar

     

     

    Imported from legacy forums. Posted by Oscar (had 640 views)

    User (Old forums)
    Member
    Post count: 23064

    Sorry for posting again, it’s just that I wasn’t able to solve this yet… and it is locking me on advancing my project.

     Thanks agains

    Oscar

    Imported from legacy forums. Posted by Oscar (had 852 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.