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

[Solved] How to make column HeaderTemplate look like the skin's column headers?

1 Answer 84 Views
Grid
This is a migrated thread and some comments may be shown as answers.
bemara57
Top achievements
Rank 1
bemara57 asked on 23 May 2008, 11:21 PM
I have a custom column header template for my RadGrid. Does anyone know how to make the header look like the native column headers? This is what my header template looks like:

            <Columns>
                <telerik:GridTemplateColumn>
                    <HeaderTemplate>
                        <center>
                        <table id="ColumnSortHeader" cellspacing="1" cellpadding="1" border="0">
                            <tr align="center">
                                <td>
                                    <a href="#">Price Low to High</a>
                                </td>
                                <td>
                                    <a href="#">Price High to Low</a>
                                </td>
                                <td>
                                    <a href="#">Name A-Z</a>
                                </td>
                                <td>
                                    <a href="#">Name Z-A</a>
                                </td>
                            </tr>
                        </table>
                        </center>
                    </HeaderTemplate>
                </telerik:GridTemplateColumn>  
            </Columns>   

What I wanted to do is make the cells look like the skin set for the RadGrid. Is this possible?

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 26 May 2008, 05:29 AM
Hi,

Try accessing the column header using the Column UniqueName property and apply style to it as shown below.

CS:
 protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
     { 
         if (e.Item is GridHeaderItem) 
         { 
             GridHeaderItem header = (GridHeaderItem)e.Item; 
             header["columnUniqueName"].BackColor = System.Drawing.Color.Pink; 
             header["columnUniqueName"].ForeColor = System.Drawing.Color.Black; 
 
         } 
    } 

Thanks
Shinu.
Tags
Grid
Asked by
bemara57
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or