4 Answers, 1 is accepted
0
Accepted
Shinu
Top achievements
Rank 2
answered on 11 Sep 2009, 04:30 AM
Hello,
Try the following code snippet in order to change the text/image of GridButtonColumn dynamically.
ASPX:
CS:
-Shinu.
Try the following code snippet in order to change the text/image of GridButtonColumn dynamically.
ASPX:
| <telerik:GridButtonColumn Text="MyButton" UniqueName="MyButton" CommandName="MyButtonClick"> |
| </telerik:GridButtonColumn> |
| <telerik:GridButtonColumn ButtonType="ImageButton" ImageUrl="~/images/Image1.gif" |
| UniqueName="print" Text="Print "> |
| </telerik:GridButtonColumn> |
CS:
| protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| if (e.Item is GridDataItem) |
| { |
| GridDataItem item = (GridDataItem)e.Item; |
| if (item["CustomerID"].Text == "ALFKI") |
| { |
| (item["MyButton"].Controls[0] as LinkButton).Text = "ALFKI"; |
| (item["print"].Controls[0] as ImageButton).ImageUrl = "~/images/Image2.png"; |
| } |
| } |
| } |
-Shinu.
0
RJ
Top achievements
Rank 1
answered on 11 Sep 2009, 06:21 AM
Thanks a lot shinu
0
RJ
Top achievements
Rank 1
answered on 25 Sep 2009, 06:41 PM
Hi Shinu,
How can I apply the same principle for DetailTable?
Thanks,
RJ
0
RJ
Top achievements
Rank 1
answered on 28 Sep 2009, 08:52 PM
I was able to make it work with detailtable using the e.item.ownertableview.name in item databound.