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.
Unfortunately, activation email could not send to your email. Please try again.

GridDataBoundGrid.ResizeToFit question/issue

Thread ID:

Created:

Updated:

Platform:

Replies:

29622 May 30,2005 03:54 PM May 30,2005 06:42 PM Windows Forms 4
loading
Tags: GridControl
Andy Johnson
Asked On May 30, 2005 03:54 PM

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 04:11 PM

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 05:24 PM

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 06:31 PM

Right before you call this._searchEventsDG.Model.ColWidths.ResizeToFit(GridRangeInfo.Table()); try adding this code:
if(this._searchEventsDG.InvokeRequired())
{
   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 06:42 PM

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

CONFIRMATION

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.

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.

;