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

GridAwareTextBox and read only cells

Thread ID:

Created:

Updated:

Platform:

Replies:

7101 Sep 11,2003 11:53 PM UTC Mar 12,2004 07:45 PM UTC WinForms 5
loading
Tags: GridControl
Sue Harris
Asked On September 11, 2003 11:53 PM UTC

I have a virtual grid and a GridAwareTextBox. Some of the cells in my grid are read only, but the GridAwareTextBox doesn't seem to pick up on that, and so allows editing of the cell. Is there a way to prevent this, or do I need to hook one of the grid events and set the read only property of the text box as the cell changes? Thanks, Sue

Administrator [Syncfusion]
Replied On September 12, 2003 07:50 AM UTC

Currently, you will have to handle this yourself. Below is one place you can do it. Setting the textBox to readonly will gray the background. If you do not want this, you can reset it as below.
private void grid_CurrentCellMoved(object sender, GridCurrentCellMovedEventArgs e)
{
	GridCurrentCell cc = this.gridControl2.CurrentCell;
	this.gridAwareTextBox2.ReadOnly = this.gridControl2[cc.RowIndex, cc.ColIndex].ReadOnly;
	if(this.gridAwareTextBox2.ReadOnly)
		this.gridAwareTextBox2.BackColor = Color.White;
}

John Baker
Replied On March 4, 2004 01:47 PM UTC

This works great, but my CellHeader text shows up in the textbox when I select a column. How do we clear the gridawaretextbox without clearing the cell? IE. If you don''t want cell values showing when readonly. >Currently, you will have to handle this yourself. Below is one place you can do it. Setting the textBox to readonly will gray the background. If you do not want this, you can reset it as below. > >
>private void grid_CurrentCellMoved(object sender, GridCurrentCellMovedEventArgs e)
>{
>	GridCurrentCell cc = this.gridControl2.CurrentCell;
>	this.gridAwareTextBox2.ReadOnly = this.gridControl2[cc.RowIndex, cc.ColIndex].ReadOnly;
>	if(this.gridAwareTextBox2.ReadOnly)
>		this.gridAwareTextBox2.BackColor = Color.White;
>}
>
>

Administrator [Syncfusion]
Replied On March 4, 2004 03:53 PM UTC

You can handle the Header Text not showing by handling CurretnCellActivating and cancelling if you are on the header row. private void gridControl1_CurrentCellActivating(object sender, GridCurrentCellActivatingEventArgs e) { if(e.RowIndex == 0) e.Cancel = true; } This does not work for interior cells unless you want not to ss the currentcell frame when you click one. (This normally does not cause a problem with header, but does with regular cells.

John Baker
Replied On March 12, 2004 05:04 PM UTC

Well, I want to be able to select the whole column; I just don''t want the header text to show up in the GridAwareTextBox when a header cell is the currentcell. I tried to set GridAwareTextBox1.text = "", but that zaps the header from my grid. >You can handle the Header Text not showing by handling CurretnCellActivating and cancelling if you are on the header row. > >private void gridControl1_CurrentCellActivating(object sender, GridCurrentCellActivatingEventArgs e) >{ > if(e.RowIndex == 0) > e.Cancel = true; >} > > >This does not work for interior cells unless you want not to ss the currentcell frame when you click one. (This normally does not cause a problem with header, but does with regular cells.

Administrator [Syncfusion]
Replied On March 12, 2004 07:45 PM UTC

Did you try the above code, and it did not work? It seems to work for me in this sample, and you can still select the column. GridAwareTB_9402.zip

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

;