We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridDataBoundGrid.ResizeToFit question/issue

Thread ID:





29622 May 30,2005 07:54 PM UTC May 30,2005 10:42 PM UTC WinForms 4
Tags: GridControl
Andy Johnson
Asked On May 30, 2005 07:54 PM UTC

I have a GDBG that I''m trying to make work with the ResizeToFit functionality... I have been doing the following after I bind a dataview to the grid... _searchEventsDG.DataSource = _data.eventView; this._searchEventsDG.Binder.InternalColumns["AllTix"].HeaderText = "All Tix"; this._searchEventsDG.Binder.InternalColumns["YourTix"].HeaderText = "Your Tix"; this._searchEventsDG.Model.Cols.Hidden["ID"] = true; this._searchEventsDG.Model.Cols.Hidden["P1"] = true; this._searchEventsDG.Model.Cols.Hidden["P2"] = true; this._searchEventsDG.Model.Cols.Hidden["PType"] = true; this._searchEventsDG.ActivateCurrentCellBehavior = GridCellActivateAction.None; My data is updated once per minute so this doesn''t run extremely frequently... I tried adding this line to the end of it, and when I do it causes crashing and other bugs where my app stops responding... this._searchEventsDG.Model.ColWidths.ResizeToFit(GridRangeInfo.Table()); what am I doing wrong?

Administrator [Syncfusion]
Replied On May 30, 2005 08:11 PM UTC

Are you using multiple threads? If so, are you using a grid.InvokeRequired check to make sure the call to grid.model.Cols.ResizeToFit is being done on the thread that created the grid? If you run your application in the debugger and set the debugger to break on exceptions, what call stack do you get with teh exception?

Administrator [Syncfusion]
Replied On May 30, 2005 09:24 PM UTC

the function that does the binding of the dataview is in the same thread, well the function that is being called is... I know this because I ran into that same issue and had to use methodinvoke from another thread to get the databinding portion working aswell... is there something I have to do to the ResizeToFit function call or to the grid to correct this?

Administrator [Syncfusion]
Replied On May 30, 2005 10:31 PM UTC

Right before you call this._searchEventsDG.Model.ColWidths.ResizeToFit(GridRangeInfo.Table()); try adding this code:
   throw new Exception("Wrong Thread");
to check whether the call is on the wrong thread. Are you seeing any other exceptions? These are abount the only thing I can think of that would cause such behavior, a threading problem, or unhandled exceptions that are prventing the standard behavior of the code.

Administrator [Syncfusion]
Replied On May 30, 2005 10:42 PM UTC

Ya your right it''s saying its on the wrong thread... guess I''ll need to make a method invoke for this seperately from the other thread... sorry about that... thanks for the help


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon