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

WinForms subheading in RAD Gridview component!

6 Answers 172 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kerem
Top achievements
Rank 1
Kerem asked on 21 Aug 2010, 12:30 AM
hi all,

I want to make a grid with subheading.I searched on internet.But,there isn't any exact solution for this making.It can be made for asp.net gridview as on the links below.

http://www.4guysfromrolla.com/articles/072603-1.aspx
http://aspalliance.com/723_Enhancing_the_DataGrid_with_Grouped_Rows_and_Subheadings.all

My making for grid can be like on these links.

For example, each subheading can include category name,but it must be only heading format.It means that it must seem in one row wth merged all cells.

Can we do it with RAD Gridview for Windows Forms?

Kerem

6 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 25 Aug 2010, 04:43 PM
Hi Kerem Burak,

You can achieve similar look with RadGridView by using grouping. Please refer to the Grouping example in our demo application. The following blog article contains further information. I hope this helps.

Should you have other questions, please write back.

Sincerely yours,
Jack
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kerem
Top achievements
Rank 1
answered on 25 Aug 2010, 11:30 PM
Hi Jack,

I understood what you meant.I am new for RADGridview.I am trying to understand it.

But,I want a little bit special design for my program.Your opinion may be good but.I don't want it like Outloook Group by design.Let me say like that.I have got 2 tables:Categories and Products.I can use Category name from Categories table for Subheading rows.And I don't want to see up and down arrows at the beginning of the subheader rows and I want to see subheader at the center of the subheader row.You can see what I mean in the attached picture.I hope,I can explain what is my goal.

Sincelery.

Kerem.

0
Kerem
Top achievements
Rank 1
answered on 25 Aug 2010, 11:36 PM
The scenario in my previous post can be like that. I can use a SQL script that joined wtih Categories and Products tables.I hope ,they are all descriptive.

Kerem
0
Jack
Telerik team
answered on 27 Aug 2010, 05:54 PM
Hello Kerem,

Yes, similar look can be achieved by using the code that I suggested and by modifying the appearance of some grid cells. I prepared a sample:

this.radGridView1.ViewCellFormatting += new CellFormattingEventHandler(radGridView1_ViewCellFormatting);
this.radGridView1.AutoExpandGroups = true;
this.radGridView1.ShowRowHeaderColumn = false;
this.radGridView1.TableElement.GroupIndent = 0;
 
void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
    GridGroupExpanderCellElement expanderCell = e.CellElement as GridGroupExpanderCellElement;
    if (expanderCell != null)
    {
        expanderCell.Visibility = ElementVisibility.Collapsed;
    }
    GridGroupContentCellElement contentCell = e.CellElement as GridGroupContentCellElement;
    if (contentCell != null)
    {
        contentCell.TextAlignment = ContentAlignment.MiddleCenter;
    }
}

I hope it helps.

Sincerely yours,
Jack
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kerem
Top achievements
Rank 1
answered on 28 Aug 2010, 04:30 AM
Hi Jack,

I applied your code my sample gridview.But, there is something wrong with code. There isnt any "GridGroupContentCellElement" class,so I could not use the lines about this class as below.

  GridGroupContentCellElement contentCell = e.CellElement asGridGroupContentCellElement;
    if (contentCell != null)
    {
        contentCell.TextAlignment = ContentAlignment.MiddleCenter;
    }

Also, I attached a picture for what I aim. Can we do these actions to grid for its view. I noted something into picture what I dont want to them by using gridview.

Thanks in advance.

Kerem 
0
Jack
Telerik team
answered on 28 Aug 2010, 09:38 AM
Hi Kerem,

This element exists only in our latest release - Q2 2010. I recommend that you try it. We will appreciate your feedback.

You can hide the group panel and the column headers by using the following code:

this.radGridView1.MasterGridViewTemplate.ShowColumnHeaders = false;
this.radGridView1.ShowGroupPanel = false;

The group header text is fully customizable. Find more details in this blog article and in our online help.

Sincerely yours,
Jack
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Kerem
Top achievements
Rank 1
Answers by
Jack
Telerik team
Kerem
Top achievements
Rank 1
Share this question
or