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.

Dynamically setting cell properties

Thread ID:

Created:

Updated:

Platform:

Replies:

21273 Nov 5,2004 08:15 AM Nov 5,2004 01:10 PM Windows Forms 1
loading
Tags: GridControl
Neal Tillotson
Asked On November 5, 2004 08:15 AM

Hi, A few questions about conditionally setting cell properties: 1. In the below code sample, the readonly property is being properly set in the desired columns and rows. The backcolor property, however, is being improperly set to red in what appear to be random rows. After the initial load of the grid, clicking on random rows will produce random red cells (although all in the proper column). 2. Why would this exact same code produce no result in the PrepareViewStyleInfo event? 3. What''s the simplest way change the textcolor of a cell once it''s been edited? Please note that all columns are initialized to ReadOnly = true. private void gridLedger_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { if(data condition is met...) { this.gridLedger.Model.IgnoreReadOnly = true; e.Style.ReadOnly = false; e.Style.BackColor = System.Drawing.Color.Red; this.gridLedger.Model.IgnoreReadOnly = false; } } Regards, Neal

Administrator [Syncfusion]
Replied On November 5, 2004 01:10 PM

Try not using IgnoreReadOnly to see if this will avoid the problem. It should not be needed in QueryCellInfo. Here is a KB on why ReadONly needs to be set in QueryCellInfo and not PrepareViewStyleInfo. http://www.syncfusion.com/Support/article.aspx?id=10351 To set the color while you are editing, try handling PrepareViewStyleInfo. If the e.ColIndex and e.RowIndex point to the current cell (grid.CurrentCell.RowIndex and grid.CurrentCell.COlIndex) and grid.CurrentCell.IsEditing, then set teh color.

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.

;