4 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 19 Nov 2008, 06:48 AM
Hello Amol,
You can try out the following code to add an ImageButton in the grid header(Pivot Data).
cs:
Thanks
Princy.
You can try out the following code to add an ImageButton in the grid header(Pivot Data).
cs:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridHeaderItem) |
{ |
GridHeaderItem header = (GridHeaderItem)e.Item; |
ImageButton imgBtn = new ImageButton(); |
imgBtn.ImageUrl = "images (2)/New Bitmap Image.bmp"; |
imgBtn.PostBackUrl = "Default2.aspx"; |
header[(RadGrid1.MasterTableView.AutoGeneratedColumns[1] as GridBoundColumn).UniqueName].Controls.Add(imgBtn); |
} |
} |
Thanks
Princy.
0
Jagadeeswaran
Top achievements
Rank 1
answered on 01 Dec 2008, 01:58 PM
Hi,
I did the same way as mentioned above, but the sorting is not working properly.
When I click first time the column sorts "asc" and the image also shown up. But if I click on the same column to sort in "desc" does not work.
This doesn't throw any error and the sort icon still shows "asc".
Please help to resolve this issue.
Thanks in advance.
Regards,
Jagadees.
I did the same way as mentioned above, but the sorting is not working properly.
When I click first time the column sorts "asc" and the image also shown up. But if I click on the same column to sort in "desc" does not work.
This doesn't throw any error and the sort icon still shows "asc".
Please help to resolve this issue.
Thanks in advance.
Regards,
Jagadees.
0
Jagadeeswaran
Top achievements
Rank 1
answered on 02 Dec 2008, 06:28 AM
Please do the same in the grid prerender event..
Regards,
Jagadees
Regards,
Jagadees
0
Hi Jagadeeswaran,
Indeed, since the itemdatabound event handler is not raised on each lifecycle for the control, whereas the PreRender event handler is, you can utilize the PreRender event handler, and get a reference to the header item, to add any necessary items.
Best wishes,
Yavor
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Indeed, since the itemdatabound event handler is not raised on each lifecycle for the control, whereas the PreRender event handler is, you can utilize the PreRender event handler, and get a reference to the header item, to add any necessary items.
Best wishes,
Yavor
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.