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

[Solved] RadGrid Rowbound

2 Answers 176 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ash
Top achievements
Rank 1
Ash asked on 05 May 2008, 07:27 PM
I have a Radgrid Control on my aspx page with one hyperlink column. I bind my grid with my datatable.  But the hyperlink column data will point to different urls, depends on its value. I need to check  the values on every rowbound and then setup the url for that row. How do I do that.  Which event fires on each rowbound. how do i access my row and  my hyperlink column. i have following:

http://www.telerik.com/DEMOS/ASPNET/Prometheus/Grid/Examples/GeneralFeatures/ColumnTypes/DefaultCS.aspx

but still i am not clear. please let me know the event that will fire and how do i write code to access that event to get my row data.

2 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 05 May 2008, 08:12 PM
It sounds to me like you need to use the ItemCreated event which will fire for each row in the grid.  In that event handler you can get values from your bound controls and set the url of your hyperlink.
0
Shinu
Top achievements
Rank 2
answered on 06 May 2008, 07:46 AM
Hi,

Try the following code snippet to access HyperLink control in a GridHyperLink column.

CS:
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridDataItem) 
        { 
            GridDataItem item = (GridDataItem)e.Item; 
            HyperLink hyplnk = (HyperLink)item["columnUniqueName"].Controls[0]; 
            hyplnk.NavigateUrl = "~/Default4.aspx" ; 
            
        } 
    } 


Thanks
Shinu.
Tags
Grid
Asked by
Ash
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or