gridView - Unable to disable gridlines

1 Answer 26 Views
GridView
Troy
Top achievements
Rank 3
Iron
Iron
Iron
Troy asked on 08 May 2022, 01:25 AM

I've searched and found a few suggestions on how to do this, but none of them seem to work for me.  

Here's what I've tried in the CellFormatting event:

        e.CellElement.DrawBorder = False
        e.CellElement.BorderWidth = 0
        e.CellElement.BorderBottomWidth = 0
        e.CellElement.BorderTopWidth = 0
        e.CellElement.BorderLeftWidth = 0
        e.CellElement.BorderRightWidth = 0

and I'm still seeing a horizontal line between rows:

Clearly I'm not doing the right thing, can someone please point me in the right direction?  

Thanks!

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Dinko | Tech Support Engineer
Telerik team
answered on 09 May 2022, 07:39 AM

Hello Troy,

Thank you for the provided code snippet.

The approach here depends on the used theme.  For example, the FluentDark theme defines border styles both on the cell and row elements. To remove the border in this case you will need to subscribe to both CellFormatting and RowFormatting events.

private void RadGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
    e.CellElement.BorderBottomColor = Color.Transparent;
    e.CellElement.BorderTopColor = Color.Transparent;
}

private void RadGridView1_RowFormatting(object sender, RowFormattingEventArgs e)
{
    e.RowElement.BorderBottomColor = Color.Transparent;
}

In your project, you could try adding the code in the RowFormatting event handler and check if the bottom border is still visible. 

Regards,
Dinko
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Troy
Top achievements
Rank 3
Iron
Iron
Iron
commented on 09 May 2022, 10:27 PM

Dinko,

Thank you very much, that did what I needed.  The trick was the combination of the cell and the row together.  They must both have borders on the theme I used.  

Thanks!

Tags
GridView
Asked by
Troy
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or