Can't change back color of RadGirdView from other form

1 Answer 37 Views
GridView
Philip
Top achievements
Rank 1
Philip asked on 18 Apr 2024, 10:58 AM

I am calling a panel from another form so I can re-use it without having duplicate code. This panel has a RadViewGrid, but because it is called outside of its parent form it doesn't seem to call the CellFormatting handle. I am trying to style the cells in code, but backcolor doesn't seem to do anything

'Create new form to display pnlPayment
 Dim FormPayment As Form = New Form
FormPayment.Size = New Size(1070, 652)
FormPayment.Name = "FormPayment"
FormPayment.StartPosition = FormStartPosition.CenterScreen
FormPayment.FormBorderStyle = FormBorderStyle.FixedDialog
FormPayment.ControlBox = False
FormPayment.Controls.Add(FrmCashRegister.pnlPayment)

'dynamically find this. can also be done with FrmCashRegister.pnlPayment.Visible = true but I wrote it like this to be sure and to make my life hard
Dim paymentpanel() As Control = FormPayment.Controls.Find("pnlPayment", False).

paymentpanel(0).Visible = True
FrmCashRegister.RadGridViewPayment.AutoSizeRows = True
FrmCashRegister.RadGridViewPayment.EnableAlternatingRowColor = True
For Each row As Telerik.WinControls.UI.GridViewRowInfo In FrmCashRegister.RadGridViewPayment.Rows
    For Each cell In row.Cells
        cell.Style.DrawFill = True
        cell.Style.ForeColor = Color.White 'works
        cell.Style.BackColor = Color.Blue 'doesn't work
    Next
Next

The cell.Style.ForeColor works, but cell.Style.BackColor does not.

I've tried getting the CellElement and assigning styling there but that doesn't work either.

1 Answer, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 23 Apr 2024, 08:09 AM

Hello, Philip,

I have noticed that you submitted the same question twice. Your question has already been answered in ticket ID: 1649513. Please see our answer there. You can find the ticket in your Telerik account. 

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
GridView
Asked by
Philip
Top achievements
Rank 1
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or