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

[Solved] Grid with hyper link column

1 Answer 114 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Babul Sahu
Top achievements
Rank 1
Babul Sahu asked on 28 Oct 2009, 07:05 AM
Hi,

On a grid with hyper link column, client event is not firing when clicking the hyper link. It is firing when you click any other column.


With Regards,
Babul

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 28 Oct 2009, 08:17 AM
Hello Babul,

You can access the hyperlink control and then add an onclick attribute to it as shown below:
c#:
 protected void RadGrid_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        if (e.Item is GridDataItem) 
        { 
            GridDataItem dataItem = (GridDataItem)e.Item; 
            HyperLink hyperlink = (HyperLink)dataItem["HyperLinkColumn"].Controls[0]; 
            hyperlink.Attributes.Add("onClick""Clicked();"); 
        } 
    } 

js:
function Clicked() 
    { 
       alert('You Clicked me!'); 
    } 

Thanks
Princy.
Tags
Grid
Asked by
Babul Sahu
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or