I have the following grid (as a sample)
<
telerik:RadGrid
runat
=
"server"
ID
=
"RadGrid1"
AllowSorting
=
"true"
AllowPaging
=
"true"
PageSize
=
"15"
AutoGenerateColumns
=
"false"
ShowDesignTimeSmartTagMessage
=
"false"
Width
=
"9700px"
AllowFilteringByColumn
=
"true"
GroupingSettings-CaseSensitive
=
"false"
>
<
MasterTableView
GroupLoadMode
=
"Client"
DataKeyNames
=
"Id"
NoMasterRecordsText
=
"No records."
>
<
ColumnGroups
>
<
telerik:GridColumnGroup
HeaderText
=
"[Group1]"
Name
=
"grp1"
/>
<
telerik:GridColumnGroup
HeaderText
=
"[Group2]"
Name
=
"grp2"
/>
</
ColumnGroups
>
<
Columns
>
<
telerik:GridBoundColumn
UniqueName
=
"Item1a"
DataField
=
"Item1a"
HeaderText
=
"[Item 1a]"
ColumnGroupName
=
"grp1"
AutoPostBackOnFilter
=
"true"
FilterListOptions
=
"VaryByDataType"
CurrentFilterFunction
=
"Contains"
FilterControlWidth
=
"100px"
>
<
HeaderStyle
HorizontalAlign
=
"Left"
Width
=
"120px"
Wrap
=
"false"
/>
<
ItemStyle
HorizontalAlign
=
"Left"
Width
=
"120px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"Item1b"
DataField
=
"Item1b"
HeaderText
=
"[Item 1b]"
ColumnGroupName
=
"grp1"
AutoPostBackOnFilter
=
"true"
FilterListOptions
=
"VaryByDataType"
CurrentFilterFunction
=
"Contains"
FilterControlWidth
=
"100px"
>
<
HeaderStyle
HorizontalAlign
=
"Left"
Width
=
"120px"
Wrap
=
"false"
/>
<
ItemStyle
HorizontalAlign
=
"Left"
Width
=
"120px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"Standalone"
DataField
=
"Standalone"
HeaderText
=
"[Stand Alone]"
AutoPostBackOnFilter
=
"true"
FilterListOptions
=
"VaryByDataType"
CurrentFilterFunction
=
"Contains"
FilterControlWidth
=
"100px"
>
<
HeaderStyle
HorizontalAlign
=
"Left"
Width
=
"120px"
Wrap
=
"false"
/>
<
ItemStyle
HorizontalAlign
=
"Left"
Width
=
"120px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"Item2a"
DataField
=
"Item2a"
HeaderText
=
"[Item 2a]"
ColumnGroupName
=
"grp2"
AutoPostBackOnFilter
=
"true"
FilterListOptions
=
"VaryByDataType"
CurrentFilterFunction
=
"Contains"
FilterControlWidth
=
"100px"
>
<
HeaderStyle
HorizontalAlign
=
"Left"
Width
=
"120px"
Wrap
=
"false"
/>
<
ItemStyle
HorizontalAlign
=
"Left"
Width
=
"120px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"Item2b"
DataField
=
"Item2b"
HeaderText
=
"[Item 2b]"
ColumnGroupName
=
"grp2"
AutoPostBackOnFilter
=
"true"
FilterListOptions
=
"VaryByDataType"
CurrentFilterFunction
=
"Contains"
FilterControlWidth
=
"100px"
>
<
HeaderStyle
HorizontalAlign
=
"Left"
Width
=
"120px"
Wrap
=
"false"
/>
<
ItemStyle
HorizontalAlign
=
"Left"
Width
=
"120px"
/>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
I am trying to alter the text on both the ColumnGroup items and the GridHeader items.
I can change the ColumnGroup text like this (in ItemDataBound):
RadGrid1.MasterTableView.ColumnGroups.FindGroupByName(
"grp1"
).HeaderText =
"First Group"
But when I try to rename the GridHeader (as I have done numerous times before), there is no change
Private
Sub
RadGrid1_ItemDataBound(sender
As
Object
, e
As
GridItemEventArgs)
Handles
RadGrid1.ItemDataBound
If
(
TypeOf
e.Item
Is
GridHeaderItem)
Then
Dim
header
As
GridHeaderItem = e.Item
CType
(header(
"Item1a"
).Controls(0), LinkButton).Text =
"Group 1 - Item 1"
CType
(header(
"Item1b"
).Controls(0), LinkButton).Text =
"Group 1 - Item 2"
CType
(header(
"Item2a"
).Controls(0), LinkButton).Text =
"Group 2 - Item 1"
CType
(header(
"Item2b"
).Controls(0), LinkButton).Text =
"Group 2 - Item 2"
End
if
What am I doing wrong?