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

[Solved] Putting image button inside radgrid and add navigation link

1 Answer 163 Views
Grid
This is a migrated thread and some comments may be shown as answers.
noyan
Top achievements
Rank 1
noyan asked on 22 Oct 2009, 11:40 AM
I have a database which contains Link and LinkPdf columns now want to add image buttons to the radgrid when user clicked adobe button a new page will open and direct to pdf link which is given in LinkPdf column.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 22 Oct 2009, 12:17 PM
Hi Noyan,

I have achieved the functionality by using GridButtonColumn and setting the PostBackUrl from code behind. Here is the code that I tried.

C#:
 
 
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    if (e.Item is GridDataItem) 
    { 
        GridDataItem item = (GridDataItem)e.Item; 
        ImageButton button = (ImageButton)item["GridButtonColumn1"].Controls[0]; 
        button.PostBackUrl = item.GetDataKeyValue("LinkPdf").ToString();  // Set the DataKeyNames="LinkPdf" for MasterTableView 
    } 

-Shinu.
Tags
Grid
Asked by
noyan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or