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

Readonly Cell (Static)

Thread ID:

Created:

Updated:

Platform:

Replies:

16765 Jul 23,2004 11:28 AM UTC Jul 27,2004 10:37 AM UTC WinForms 11
loading
Tags: GridControl
Satish
Asked On July 23, 2004 11:28 AM UTC

Clay, I have 4 columns, out of 4 columns 1 column is ''Static'' cell. When we use Find & Replace, the value in the ''Static'' cell also getting changed, which basically I dont want to change. How to achieve this? Thanks Satish

Administrator [Syncfusion]
Replied On July 23, 2004 11:30 AM UTC

In addition to setting style.CellType = "Static" for the column, have you tried also setting style.ReadOnly = true for that column to see if this will prevent the replace.

Satish
Replied On July 23, 2004 11:48 AM UTC

Clay, Thanks it worked. Another Question. I have 3 Columns Example RowNumber A B C(C=A+B) 1 10 10 20 2 30 10 40 3 20 10 30 Is there any way, i need to see the output value of C without writing any code. Note : User can change the value in A & B. But output should be varied based on A & B Value. Thanks Satish >In addition to setting style.CellType = "Static" for the column, have you tried also setting style.ReadOnly = true for that column to see if this will prevent the replace.

Administrator [Syncfusion]
Replied On July 23, 2004 12:20 PM UTC

If this is a GridDataBoundGrid, you can add a new DataColumn to the DataTable and set its Expression property to compute [A] + [B]. Then you would use this column as column C. If this is a GridControl, you could set the style.CellType for column 3 to be "FormulaCell". Then you could loop from row = 1 to grid.RowCound setting grid[row, 3].Text = string.Format("= A{0} + B{0}", row);

Satish
Replied On July 26, 2004 07:54 AM UTC

How to prevent user to rightclick on the static cell column and focus should not be set for the static cell. Thanks Satish >If this is a GridDataBoundGrid, you can add a new DataColumn to the DataTable and set its Expression property to compute [A] + [B]. Then you would use this column as column C. > >If this is a GridControl, you could set the style.CellType for column 3 to be "FormulaCell". Then you could loop from row = 1 to grid.RowCound setting > >grid[row, 3].Text = string.Format("= A{0} + B{0}", row); >

Administrator [Syncfusion]
Replied On July 26, 2004 07:58 AM UTC

You can try setting style.Enabled = false on that cell to see if that does what you want.

Satish
Replied On July 26, 2004 09:09 AM UTC

No Luck. Same problem. At any cost user should not able to select that particular column (Static Cell) I tried putting readonly, enabled.. Thanks Satish >You can try setting style.Enabled = false on that cell to see if that does what you want.

Administrator [Syncfusion]
Replied On July 26, 2004 09:32 AM UTC

Static + Enabled=false seems to work in this sample. You cannot click the colored column or move the currentcell into the column. DisableCol2_6844.zip

Satish
Replied On July 26, 2004 10:54 AM UTC

Thanks. But even I should not select the row also. Nothing needs to be selected in that column. Thanks Satish >Static + Enabled=false seems to work in this sample. You cannot click the colored column or move the currentcell into the column. >DisableCol2_6844.zip > >

Administrator [Syncfusion]
Replied On July 26, 2004 12:03 PM UTC

If you do not want certain cells selected when you select a range of cells, then you can handle grid.Model.SelectionChanging and cancel the selection when the range intersects the cells you do not want selected. (This is different than wanting a cell not to become current or get input focus.) private void Model_SelectionChanging(object sender, GridSelectionChangingEventArgs e) { if(e.Range.IntersectsWith(GridRangeInfo.Col(2))) e.Cancel = true; }

Satish
Replied On July 27, 2004 10:24 AM UTC

Clay, If i use the SelectionChanging event, I am not able to select the multiple row. So how to select multiple row. Note : Row will contain read (Static) only cells. Thanks Satish >If you do not want certain cells selected when you select a range of cells, then you can handle grid.Model.SelectionChanging and cancel the selection when the range intersects the cells you do not want selected. (This is different than wanting a cell not to become current or get input focus.) > > >private void Model_SelectionChanging(object sender, GridSelectionChangingEventArgs e) >{ > if(e.Range.IntersectsWith(GridRangeInfo.Col(2))) > e.Cancel = true; >} > > >

Administrator [Syncfusion]
Replied On July 27, 2004 10:37 AM UTC

I am confused. The reason for using the SelectionsChanging event was to avoid selecting something in column 2. I do not know how you will be able to select a row (or several rows), and still not select anything in column 2. Selecting a row, selects the cell in column 2. Is it that you want to select everything in the row except column 2? If so, then remove the SelectionChanging event, and use the technique in this forum thread to color the selection. But in your PrepareViewStyleInfo, in addition to the check that the cell is in the Selections, also check that the cell is not in column 2. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=13587

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

;