
I am using Radgridview.
I have to show hyperlink in column header .
I have created a style and assigned to header style.
I want to get that hyperlinkbutton at runtime and have to chnage its containt .
Style :
<
Style x:Key="CompanyHeaderStyle" TargetType="gridViewElements:GridViewHeaderCell">
<Setter Property="Template" >
<Setter.Value>
<ControlTemplate >
<Grid MouseLeftButtonDown="header_MouseLeftButtonDown" HorizontalAlignment="Stretch" >
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<HyperlinkButton x:Name="lnkCompanyNameInStyle" Content="Select Company to Compare"
HorizontalAlignment="Center" Click="lnkCompanyNameInStyle_Click"
Loaded="lnkCompanyNameInStyle_Loaded" Tag="0"
IsTabStop="False">
</HyperlinkButton>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
I have triend visualtreehelper but was not successful .
Thanks ,
Nandkishor
8 Answers, 1 is accepted
I suggest you to place this HyperlinkButton inside a GridViewDataColumn's Header property directly:
<
telerikGrid:RadGridView
x:Name
=
"radGridView1"
Width
=
"450"
Height
=
"450"
......>
<
telerikGrid:RadGridView.Columns
>
<
telerikGrid:GridViewDataColumn
......>
<
telerikGrid:GridViewDataColumn.Header
>
<Grid>
<
HyperlinkButton
x:Name
=
"lnkCompanyNameInStyle"
Content
=
"Select Company to Compare"
.../>
</Grid>
</
telerikGrid:GridViewDataColumn.Header
>
</
telerikGrid:GridViewDataColumn
>
</
telerikGrid:RadGridView.Columns
>
</
telerikGrid:RadGridView
>
All the best,
Vanya Pavlova
the Telerik team

Thanks for reply ,
I am adding column at code behind .
how can i do that in code behind .
Nandkishor.
Since Header property is object you can add anything. For example:
column.Header = new HyperlinkButton();
Vlad
the Telerik team


Could you please take a look at this forum thread:CheckboxInGridView.
Generally you could add the checkbox as it is shown in the previous post and using our extension method ChildrenOfType to extract the checkBoxes and determine whether it is checked or not,you can find more info about this here.
Please let me know if I can assist you further.
All the best,
Vanya Pavlova
the Telerik team

Thanks.
You can cast desired column Header property to CheckBox and set desired properties.
Kind regards,Vlad
the Telerik team