Problems with GridViewCheckBoxColumn

3 posts, 0 answers
  1. Andreas Nebel
    Andreas Nebel avatar
    16 posts
    Member since:
    Jan 2010

    Posted 18 Jul 2012 Link to this post


    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
                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
                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!
  2. Andreas Nebel
    Andreas Nebel avatar
    16 posts
    Member since:
    Jan 2010

    Posted 18 Jul 2012 Link to this post

    I hide the first Column
    MyGridView.Columns(0).IsVisible = False
    If I skip this, the colors are perfect.

  3. Stefan
    Stefan avatar
    2908 posts

    Posted 20 Jul 2012 Link to this post

    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:

    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 or visit your account for your upgrading options.

    I hope this helps.

    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Back to Top