5 Answers, 1 is accepted
0
Pedro Filipe
Top achievements
Rank 1
answered on 07 Mar 2019, 10:07 AM
hi there (bom dia)
you can select in the property builder.
but the best way is by the formatting? why not using it?
i add a problem with the scroll but this code fix the problem just need to change the colors with yours.
private
void
radGridView1_RowFormatting(
object
sender, RowFormattingEventArgs e)
{
if
(e.RowElement.IsSelected)
{
e.RowElement.GradientStyle = GradientStyles.Solid;
e.RowElement.BackColor = System.Drawing.Color.PaleGreen;
e.RowElement.DrawFill =
true
;
}
else
{
if
(e.RowElement.IsOdd)
{
e.RowElement.DrawFill =
true
;
e.RowElement.BackColor = Color.FromArgb(230, 230, 250);
}
else
{
e.RowElement.DrawFill =
true
;
e.RowElement.BackColor = Color.White;
e.RowElement.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local);
0
Hello, guys,
Indeed the RowwFormatting or CellFormatting events are the appropriate solution for customizing the rows/cells in RadGridView. Additional information is available in the following help articles:
https://docs.telerik.com/devtools/winforms/controls/gridview/rows/formatting-rows
https://docs.telerik.com/devtools/winforms/controls/gridview/cells/formatting-cells
However, if you want to enable alternating row color, it can be done by setting two properties: set the EnableAlternatingRowColor property to true and then specify the desired color to the TableElement.AlternatingRowColor:
I hope this information helps.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Indeed the RowwFormatting or CellFormatting events are the appropriate solution for customizing the rows/cells in RadGridView. Additional information is available in the following help articles:
https://docs.telerik.com/devtools/winforms/controls/gridview/rows/formatting-rows
https://docs.telerik.com/devtools/winforms/controls/gridview/cells/formatting-cells
However, if you want to enable alternating row color, it can be done by setting two properties: set the EnableAlternatingRowColor property to true and then specify the desired color to the TableElement.AlternatingRowColor:
this
.radGridView1.EnableAlternatingRowColor =
true
;
this
.radGridView1.TableElement.AlternatingRowColor = Color.Yellow;
I hope this information helps.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Ricardo
Top achievements
Rank 1
answered on 08 Mar 2019, 02:18 AM
Hello, my friend.
I'm glad you could answer my question. But I have about five or six hundred radgridviews in my project
If I add this event one by one, it's a huge job.
So I need other solutions
I'm glad you could answer my question. But I have about five or six hundred radgridviews in my project
If I add this event one by one, it's a huge job.
So I need other solutions
0
Ricardo
Top achievements
Rank 1
answered on 08 Mar 2019, 02:24 AM
Hello, my friend.
Thank you for your answer. It works very well.
But this can only control the color of the alternate row in the RadGridView, and I can control the color of the alternate row if I need another row, as in the following code (DataGridView)
GV. RowsDefaultCellStyle. BackColor = Color. White
GV. AlternatingRowsDefaultCellStyle. BackColor = Color Bisque
What should I do?
Best wishes to you.
0
Hello, Ricardo,
If you need to customize the color of the grid rows, the easiest solution would be to use the CellFormatting/ RowFormatting event:
https://docs.telerik.com/devtools/winforms/controls/gridview/cells/formatting-cells
https://docs.telerik.com/devtools/winforms/controls/gridview/rows/formatting-rows
Depending on the condition for applying the color, you can use one of the following approaches as well:
https://docs.telerik.com/devtools/winforms/controls/gridview/cells/conditional-formatting-cells
https://docs.telerik.com/devtools/winforms/controls/gridview/rows/conditional-formatting-rows
https://docs.telerik.com/devtools/winforms/controls/gridview/cells/formating-examples/style-property
Note that most of the forum threads are reviewed by Telerik representatives and sometimes we address the questions asked by our customers in the forums as well. However, a post in the forum doesn't guarantee you a response from the Telerik support team. Moreover, threads are handled according to license and time of posting, so if it is an urgent problem, we suggest you use a support ticket. Thus, our support staff will gladly assist you. Thank you for your understanding.
I hope this information helps.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
If you need to customize the color of the grid rows, the easiest solution would be to use the CellFormatting/ RowFormatting event:
https://docs.telerik.com/devtools/winforms/controls/gridview/cells/formatting-cells
https://docs.telerik.com/devtools/winforms/controls/gridview/rows/formatting-rows
Depending on the condition for applying the color, you can use one of the following approaches as well:
https://docs.telerik.com/devtools/winforms/controls/gridview/cells/conditional-formatting-cells
https://docs.telerik.com/devtools/winforms/controls/gridview/rows/conditional-formatting-rows
https://docs.telerik.com/devtools/winforms/controls/gridview/cells/formating-examples/style-property
Note that most of the forum threads are reviewed by Telerik representatives and sometimes we address the questions asked by our customers in the forums as well. However, a post in the forum doesn't guarantee you a response from the Telerik support team. Moreover, threads are handled according to license and time of posting, so if it is an urgent problem, we suggest you use a support ticket. Thus, our support staff will gladly assist you. Thank you for your understanding.
I hope this information helps.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.