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.
Syncfusion Feedback

How can I get the colWidth of a hidden column in GDBG?

Thread ID:

Created:

Updated:

Platform:

Replies:

8067 Oct 18,2003 11:17 AM UTC Oct 18,2003 01:10 PM UTC Windows Forms 1
loading
Tags: GridControl
duyu
Asked On October 18, 2003 11:17 AM UTC

Model.ColWidths[hiddenFieldName] seems return 0.

Administrator [Syncfusion]
Replied On October 18, 2003 01:10 PM UTC

This is by design. If you want to be able to access the widths of hidden columns, then you will have to do some work. You could catch the ColsHiding event and cache the colwidths there before the columns get hidden. And then use these cached values when you want to retrieve the hidden column width. Or, you could flip the hidden flag (while the grid's drawing is locked), and retrieve the widths in this manner.
private int GetHiddenColWidth(int col)
{
	bool hidden = this.gridDataBoundGrid1.Model.HideCols[col];
	int width = -1;
	if(hidden)
	{
		this.gridDataBoundGrid1.BeginUpdate();
		this.gridDataBoundGrid1.Model.HideCols[col] = false;
		width = this.gridDataBoundGrid1.Model.ColWidths[col];
		this.gridDataBoundGrid1.Model.HideCols[col] = true;
		this.gridDataBoundGrid1.EndUpdate();
	}
	return width;
}

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.

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

;