This is a migrated thread and some comments may be shown as answers.

Can we get rid of the border of Gridview?

3 Answers 170 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ray Wang
Top achievements
Rank 1
Ray Wang asked on 24 Nov 2009, 09:23 AM
Hello Telerik

First, Thank you very much for your previous's support
I have a question about Gride view.
I have attached two pictures
The First one is the File List we used Gride view.
The second one is the the File list what we want to to look like.

1: I want to know if there is any way we can remove the orange color border of the Gridview ? and if we can make the child-folder's culomn border aligned with the  super-folder?
2: Can we get rid of history folder?

Thank you very much!
 

3 Answers, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 27 Nov 2009, 09:18 AM
Hi Ray Wang,

Thank you for writing.

I think that it is possible to achieve similar behavior like the shown on your screenshot with a RadGridView. To do this you have to do the following steps:

- remove the header row for the child view
- disable the new row for the child template
- remove the padding for the GridDetailViewCellElement
- remove the border for the ChildTableElement
- bind the columns width for master and child templates

Please consider the following code as an example:

public Form1()
{
    InitializeComponent();
 
    this.radGridView1.MasterGridViewTemplate.ChildGridViewTemplates[0].ShowColumnHeaders = false;
    this.radGridView1.MasterGridViewTemplate.ChildGridViewTemplates[0].AllowAddNewRow = false;
}
 
void MasterGridViewTemplate_ColumnWidthChanged(object sender, ColumnWidthChangedEventArgs e)
{
    int columnIndex = e.ColumnIndex;
 
    this.radGridView1.MasterGridViewTemplate.ChildGridViewTemplates[0].Columns[columnIndex].Width =
        this.radGridView1.MasterGridViewTemplate.Columns[columnIndex].Width;
}
 
void radGridView1_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
{
    GridDetailViewCellElement element = e.CellElement as GridDetailViewCellElement;
 
    if (element != null)
    {
        element.Padding = new Padding(0);
        element.ChildTableElement.DrawBorder = false;
    }
}

Do not hesitate to contact me again if you have any other questions.

Regards,
Martin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ray Wang
Top achievements
Rank 1
answered on 30 Nov 2009, 03:09 PM

Hello Telerik

Thank you very much for your reply

We got your code and we can make the colum
n width the same. but that is not what we focus.

 when you selected one row, since the start X coordinate of each row will move left and Column width are the same which make all the column right border are not align.

We only want the column right border of first column are align. and all column border of other colum
n are align

Please see attachment


0
Martin Vasilev
Telerik team
answered on 03 Dec 2009, 01:27 PM
Hi Ray Wang,

Thank you for getting back to me.

Since RadGridView does not support automatic alignment of its parent and child columns, the only way to achieve that is manually to set the column width at startup in a way that the alignment matches your needs and to use ColumnWidthChanged event to keep this alignment when resizing.

Write me back if you have other questions.

Best wishes,
Martin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Ray Wang
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Ray Wang
Top achievements
Rank 1
Share this question
or