This is a migrated thread and some comments may be shown as answers.

Problems with GridViewCheckBoxColumn

2 Answers 70 Views
GridView
This is a migrated thread and some comments may be shown as answers.
n/a
Top achievements
Rank 1
n/a asked on 18 Jul 2012, 12:48 PM
Hi,

I've some problems with the GridView, If I add a GridViewCheckBoxColumn:

grdTestTools.Columns.Add("Id", "ToolId")
grdTestTools.Columns.Add("PositionNumber", "Pos.-Nr.")
grdTestTools.Columns.Add(New GridViewCheckBoxColumn("Versuch", "Test"))
grdTestTools.Columns.Add("ToolNumber", "Werkzeugnummer")
grdTestTools.Columns.Add("Manufacturer", "Hersteller")
grdTestTools.Columns.Add("Coating", "Beschichtung")
grdTestTools.Columns.Add("NumberOfAdaptors", "Schneiden")
grdTestTools.Columns.Add("ActualCumulativeAverageNumberOfPieces", "Standmenge Ist")
grdTestTools.Columns.Add("DebitCumulativeAverageNumberOfPieces", "Standmenge Soll")
grdTestTools.Columns.Add("ActualCumulativeToolingCosts", "Werkzeugekosten Ist")
grdTestTools.Columns.Add("DebitCumulativeToolingCosts", "Werkzeugekosten Soll")
grdTestTools.Columns.Add("CumulativeNumberOfTools", "Benutzte Werkzeuge")
grdTestTools.Columns.Add("CumulativeBrokenDieCounter", "davon gebrochen")

I set some colors in CellFormatting. Works fine, until I add the GridViewCheckBoxColumn. And now... well, see screenshots. The wrong colors changing after I clear and reinsert the GridView.

Private Sub grdTestTools_CellFormatting(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.CellFormattingEventArgs) Handles grdTestTools.CellFormatting
        MyColumn = e.CellElement.ColumnInfo
 
        If MyColumn.Name = "ActualCumulativeAverageNumberOfPieces" Or MyColumn.Name = "ActualCumulativeToolingCosts" Then
            'Ist-Färbung
            e.CellElement.ForeColor = CoreFunctions.MyDefaultToolActualValuesFontColor
            e.CellElement.DrawFill = True
            e.CellElement.NumberOfColors = 1
            e.CellElement.BackColor = Color.FromArgb(123, 123, 123)
 
        ElseIf MyColumn.Name = "DebitCumulativeAverageNumberOfPieces" Or MyColumn.Name = "DebitCumulativeToolingCosts" Then
            'Soll-Färbung
            e.CellElement.ForeColor = CoreFunctions.MyDefaultToolDebitValuesFontColor
            e.CellElement.DrawFill = True
            e.CellElement.NumberOfColors = 1
            e.CellElement.BackColor = Color.FromArgb(123, 123, 123)
        End If
 
End Sub

We are using RadControls 2010.2.10.0914.

And ideas? Thanks!
Andy

2 Answers, 1 is accepted

Sort by
0
n/a
Top achievements
Rank 1
answered on 18 Jul 2012, 03:11 PM
I hide the first Column
MyGridView.Columns(0).IsVisible = False
 
If I skip this, the colors are perfect.

0
Stefan
Telerik team
answered on 20 Jul 2012, 01:09 PM
Hello Andreas,

Thank you for writing.

RadGridView uses virtualization for its cells and when you are setting a value to a cell element, you need to make sure that has the coresponsing Reset too. Examples and explanation are available in this article: http://www.telerik.com/help/winforms/gridview-cells-formatting-cells.html.

A bit off topic, I would like to remind you that your subscription package has expired, which means that you are no longer entitled for our support services. I would highly recommend upgrading your license to the latest version in order to continue getting product updates and uninterrupted support services. Please, contact sales@telerik.com or visit your account for your upgrading options.

I hope this helps.

Regards,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
n/a
Top achievements
Rank 1
Answers by
n/a
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or