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.

CellType and ClearCells Questions

Thread ID:

Created:

Updated:

Platform:

Replies:

1955 Dec 5,2002 04:46 PM Dec 6,2002 05:47 PM Windows Forms 1
loading
Tags: GridControl
Tom Le Blanc
Asked On December 5, 2002 04:46 PM

I have no doubt that I'm going about this wrong, but it brought me this far... . Our grid is not data bound, but it is using the PopulateValues method to load data from an array: GridControl1.Model.PopulateValues(GridRangeInfo.Cells(0, 0, mRowCount, mColumnCount), mDataArray) The grid is used to display data three different ways. Each time the view is changed the routine with the above code is called. I start out by making all of the cells in the grid static: GridControl1.Model.TableStyle.CellType = "Static" Then I activate the rows that should be active: For RowIndex = 1 to mRowCount GridControl1.Model.RowStyles(RowIndex).CellType = "TextBox" Next And then at the end I make sure the description column is static: GridControl1.Model.ColStyles(1).CellType = "Static" GridControl1.EndUpdate() 'it starts with BeginUpdate GridControl1.Refresh() This works well enough, but in one of my views I need to turn everything the other way so I activate the rows, then before I end the update I loop through the columns and attempt to deactivate the columns I don't need: For ColumnIndex = 2 To mColumnCount 'If not the right type Then GridControl1.Model.ColStyles(ColumnIndex).CellType = "Static" 'End If Next ColumnIndex I find that while this works for the most part, I run into two problems: Unless a row's style is explicitly reset in a new view the previous view's style for that row (or cell) remains. And, when I attempt to reset the column style, the style of the row supercedes the style of the column where it has been turned on. I read Stefan's response to Reddy's posting and I now call GridControl1.Model.ClearCells(GridRangeInfo.Table, True) before I set the TableStyle.CellType. This has removed the lingering styles to an extent, but even if I call GridControl1.Model.ClearCells(GridRangeInfo.Cells(1, ColumnIndex, mRowCount, ColumnIndex), True) prior to making the column static, the rows as TextBox still exist. So, apart from asking if there's a better way to do this? Does setting a row style first override any subsequent column style modifications? And why doesn't the TableStyle or the ClearCells truly clear the cell or reset the table's style? Thanks, Tom Ps, I hope the Syncfusion crew enjoyed the snow day.

Administrator [Syncfusion]
Replied On December 6, 2002 05:47 PM

> I have no doubt that I'm going about this wrong, but it brought me this far... . Our grid is not data bound, but it is using the PopulateValues method to load data from an array: > > GridControl1.Model.PopulateValues(GridRangeInfo.Cells(0, 0, mRowCount, mColumnCount), mDataArray) > > The grid is used to display data three different ways. Each time the view is changed the routine with the above code is called. > > I start out by making all of the cells in the grid static: > > GridControl1.Model.TableStyle.CellType = "Static" > > Then I activate the rows that should be active: > > For RowIndex = 1 to mRowCount > GridControl1.Model.RowStyles(RowIndex).CellType = "TextBox" > Next > > And then at the end I make sure the description column is static: > > GridControl1.Model.ColStyles(1).CellType = "Static" > GridControl1.EndUpdate() 'it starts with BeginUpdate > GridControl1.Refresh() > > This works well enough, but in one of my views I need to turn everything the other way so I activate the rows, then before I end the update I loop through the columns and attempt to deactivate the columns I don't need: > > For ColumnIndex = 2 To mColumnCount > 'If not the right type Then > GridControl1.Model.ColStyles(ColumnIndex).CellType = "Static" > 'End If > Next ColumnIndex > > I find that while this works for the most part, I run into two problems: Unless a row's style is explicitly reset in a new view the previous view's style for that row (or cell) remains. And, when I attempt to reset the column style, the style of the row supercedes the style of the column where it has been turned on. > > I read Stefan's response to Reddy's posting and I now call > > GridControl1.Model.ClearCells(GridRangeInfo.Table, True) > > before I set the TableStyle.CellType. This has removed the lingering styles to an extent, but even if I call > > GridControl1.Model.ClearCells(GridRangeInfo.Cells(1, ColumnIndex, mRowCount, ColumnIndex), True) > > prior to making the column static, the rows as TextBox still exist. > > So, apart from asking if there's a better way to do this? Does setting a row style first override any subsequent column style modifications? And why doesn't the TableStyle or the ClearCells truly clear the cell or reset the table's style? > > Thanks, > Tom > > Ps, I hope the Syncfusion crew enjoyed the snow day. > Tom, There is a precedence order for style settings. As you note, row styles take precedence over column styles. This is discussed in section 3.2.1 user's manual and in the Quick Start\GridStyleInfoAtWork sample. You can run this sample and see how Standard/TableStyle/Column/Row/Cell styles interact with each other. If a row style is set, then now matter what you set as a column style, the row style will take precedence. As a possible solution to your problem, instead of trying to explicity set these styles, you can handle the QueryCellInfo event and dynamically provide the e.Style.CellType depending upon the e.RowIndex and e.ColIndex passed it. If you modify e.StyleInfo, you should also set e.Handled = true. Clay

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.

;