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

[Solved] Radgrid Custom Header Text

3 Answers 297 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mehmet Tirgil
Top achievements
Rank 1
Mehmet Tirgil asked on 15 Dec 2009, 09:03 AM
Hi,
i try radgrid custom header text. My code like this in Radgrid ItemCreated

Dim HeaderItem As GridHeaderItem = CType(e.Item, GridHeaderItem)
Dim Button As LinkButton = CType(HeaderItem("ListOrder").Controls(0), LinkButton)
Button.Text = "Custom Header"

It is ok first use. But after sorting or change page then custom header get default values, not my custom header text. I use also RadGrid PreRender for default filter.

I try to use custom header in Rad Grid Prerender like this;

GvwItems.Columns.FindByUniqueName("ListOrder").HeaderText = "Custom Header"

But I also user hierarchy table, so in prerender, my hierarchy tables columns header do not change like this. Ony master table column header change using methoıd in prerender.

3 Answers, 1 is accepted

Sort by
0
Accepted
Sebastian
Telerik team
answered on 15 Dec 2009, 11:23 AM
Hello Mehmet,

The proper place to apply the custom header text in this way is the ItemDataBound server event handler of the grid as opposed to ItemCreated. Thus the text should be persisted when you perform sorting/paging/etc. operation. The major differences between both events are outlined in this help topic.

Additionally, how to distinguish whether the currently bound item belongs to the master or a detail table you can find out from this article.

Best regards,
Sebastian
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Mehmet Tirgil
Top achievements
Rank 1
answered on 15 Dec 2009, 01:00 PM
Hi,
I try to write my code in ItemDataBound. But the same issue occurs. When sorting, filtering or change page, my custom headers disappear.
0
Mehmet Tirgil
Top achievements
Rank 1
answered on 15 Dec 2009, 02:35 PM
Hi,
my problem was solved as you told. I forgot a trick in pageload. In the page load i have an object that get header's texts. I put function in postback. After remove that (postaback = false) and write code in ıtemdatabound, everthing is ok when filtering, sorting or pagechange
Thanks
Tags
General Discussions
Asked by
Mehmet Tirgil
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Mehmet Tirgil
Top achievements
Rank 1
Share this question
or