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

[Solved] Editing GridView header

1 Answer 74 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Niranjan
Top achievements
Rank 1
Niranjan asked on 30 Sep 2010, 04:21 AM
Hi All,

Is it possible to edit GridView header? When user double clicks the header column, it should allow me to change the header text.

Please let me know if anyone have any solution for this.

Thanks in advance

Regards,
Niranjan

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 05 Oct 2010, 03:43 PM
Hello Niranjan,

Basically, you may predefine the ContentTemplate of the GridViewHeaderCell and put a custom control of yours that handles the double-click and editing. For example:

<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" >
    <telerik:GridViewDataColumn.HeaderCellStyle>
        <Style TargetType="telerik:GridViewHeaderCell">
            <Setter Property="ContentTemplate">
                <Setter.Value>                                       
             <DataTemplate>                                       
                <TextBlock Text="MyHeader"                                                      VerticalAlignment="Center"           
                      HorizontalAlignment="Center"/>                                      </DataTemplat>
           </Setter.Value>
             </Setter>                         
        </Style>                      
   </telerik:GridViewDataColumn.HeaderCellStyle>
</telerik:GridViewDataColumn>

Here the code is with a TextBlock, but this is the place to put the custom control you create. 

 

Kind regards,
Maya
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
Niranjan
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or