Hi,
I would like to use horizontal and vertical lines (borders) for cells to divide the information of the gridview and see it clearly. At the moment I have a gridview without any line and it´s difficult to see well the datas.
how can I do it?
Thank you in advance.
I would like to use horizontal and vertical lines (borders) for cells to divide the information of the gridview and see it clearly. At the moment I have a gridview without any line and it´s difficult to see well the datas.
how can I do it?
Thank you in advance.
5 Answers, 1 is accepted
0
Prad
Top achievements
Rank 2
answered on 02 Jun 2009, 04:11 PM
Use RadGRIDView_CellFormatting Event to set the border style.
0
Accepted
Prad
Top achievements
Rank 2
answered on 02 Jun 2009, 04:13 PM
if (e.CellElement.ColumnInfo is GridViewDataColumn) |
{ |
e.CellElement.DrawFill = true; |
e.CellElement.NumberOfColors = 1; |
e.CellElement.DrawBorder = true; |
e.CellElement.BorderBoxStyle = Telerik.WinControls.BorderBoxStyle.FourBorders; |
e.CellElement.BorderLeftWidth = 1; |
e.CellElement.BorderRightWidth = 1; |
e.CellElement.BorderBottomWidth = 1; |
e.CellElement.BorderTopWidth = 0; |
e.CellElement.BorderBottomColor = Color.Gray; |
e.CellElement.BorderTopColor = Color.Gray; |
e.CellElement.BorderLeftColor = Color.Gray; |
e.CellElement.BorderRightColor = Color.Gray; |
} |
inside code block..
** I suggest having Theme set with your desired border width, color.... and applying the theme file (XML) to your grid. This will reduce your LOC. Use Style builder to build your broder width color.
Pradeep
Pradeep
0
Accepted
Hi Patxi,
Thanks for your question.
As Pradeep has shown, you can define a border for a cell in the RadGridView control either by using CellFormatting event and setting the shown properties or by creating a new custom theme for RadGridView using the Visual Style Builder.
I hope this information will be helpful for you to achieve your goal. You can write any time you have further questions.
All the best,
Deyan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Thanks for your question.
As Pradeep has shown, you can define a border for a cell in the RadGridView control either by using CellFormatting event and setting the shown properties or by creating a new custom theme for RadGridView using the Visual Style Builder.
I hope this information will be helpful for you to achieve your goal. You can write any time you have further questions.
All the best,
Deyan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Pablo Alejandre del Rio
Top achievements
Rank 1
answered on 22 Jun 2009, 10:17 AM
Hi Telerik:
I have tried the event version and it's working, but I would like to do it properly in the Visual Style Builder.
Basically the problem is I don't know what Control element structure I have to modify, i mean , apply all that properties i am adding in the cellformating event.
Do you know where ?
Thanks. Pablo
0
Hello Pablo Alejandre del Rio,
You can easily modify the existing themes or create new themes for the RadGridView control by using the Visual Style Builder.
In order to modify the style for a GridDataCellElement, you should load the RadGridView control in the Visual Style Builder and in the Element Tree on the left you should find the GridDataRowElement node. After that you should select the GridDataCellElement child of this node and modify its settings in the property grid on the right.
In this way you can easily modify the appearance of all Visual Elements within RadGridView and save these modifications as a theme which you can later use.
You can read more about themeing of RadGridView in the Styling and Appearance section of the RadGridView's help: http://www.telerik.com/help/winforms/grid_modifying-themes-tutorial.html
I hope this is helpful.
Do not hesitate to write back if you need further assistance.
Regards,
Deyan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
You can easily modify the existing themes or create new themes for the RadGridView control by using the Visual Style Builder.
In order to modify the style for a GridDataCellElement, you should load the RadGridView control in the Visual Style Builder and in the Element Tree on the left you should find the GridDataRowElement node. After that you should select the GridDataCellElement child of this node and modify its settings in the property grid on the right.
In this way you can easily modify the appearance of all Visual Elements within RadGridView and save these modifications as a theme which you can later use.
You can read more about themeing of RadGridView in the Styling and Appearance section of the RadGridView's help: http://www.telerik.com/help/winforms/grid_modifying-themes-tutorial.html
I hope this is helpful.
Do not hesitate to write back if you need further assistance.
Regards,
Deyan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.