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

Customize Grid Header

3 Answers 123 Views
Grid
This is a migrated thread and some comments may be shown as answers.
jalal
Top achievements
Rank 1
jalal asked on 20 Jan 2009, 10:51 AM
hi,

i want to add new row with merged cells above the header cells. for example, let us suppose that we have a grid displays projects status during 3 months (3 columns) as the following:

Jan - Feb - Mar

 10  -  20  - 30

the first row form the header, the second row is data row.

i want to add new row above the columns header, as follows:

   My Projects
Jan - Feb - Mar

 10  -  20  - 30

the first two rows form the header, the last row form data row.

it is urgent,,,,

Thanks and regards

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 20 Jan 2009, 01:04 PM
Hello Jalal,

You can use the Caption property of the Radgrid MasterTableView to add title above the RadGrid header.
ASPX:
<MasterTableView autogeneratecolumns="False" datasourceid="SqlDataSource1" Caption="My Projects"

Another option is, that you can add Label in CommandItemTemplate and set the text as "My Projects".
CSS:
<style type="text/css">  
.CommandRow  
{         
    padding-left450px;   
}      
</style> 

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1">  
<MasterTableView autogeneratecolumns="False" datasourceid="SqlDataSource1" CommandItemDisplay="Top">  
<CommandItemTemplate> 
    <asp:Label ID="Label1" runat="server" Text="My Projects"></asp:Label> 
</CommandItemTemplate> 
<Columns>      
       . . .  
</Columns> 
</MasterTableView> 
</telerik:RadGrid> 

CSS:
<style type="text/css">  
.CommandRow  
{         
    padding-left450px;   
}      
</style> 

CS:
protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)  
{  
    if (e.Item is GridCommandItem)  
    {  
        GridCommandItem item = (GridCommandItem)e.Item;  
        item.CssClass = "CommandRow";  
    }  

Thanks,
Princy.
0
jalal
Top achievements
Rank 1
answered on 21 Jan 2009, 04:10 AM

Thanks a lot, but what I need is to add a title above specific columns not over whole Grid header…

is there a solution...

0
Sebastian
Telerik team
answered on 21 Jan 2009, 09:11 AM

Hi jalal,

Please review our reply in the other forum thread you opened in connection with this subject:

http://www.telerik.com/community/forums/aspnet-ajax/grid/tree-grouping.aspx

Best regards,

Sebastian
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
jalal
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
jalal
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or