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

gridhyperlink column

1 Answer 99 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kieran
Top achievements
Rank 1
Kieran asked on 17 May 2010, 10:30 PM
Hi

I have added hyperlink column to grid but only want to lin kl to be visible when the datanavigaterulfields  (one field in this case) have a value

Any pointers?

thanks

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 18 May 2010, 06:50 AM
Hello Kieran,

In order to make the GridHyperLinkColumn visible based on DataNavigateUrlFields,you have to access that field value and check whether it is empty or not. Give a try with the following code and see whether it helps you.

ASPX:
<telerik:GridHyperLinkColumn DataTextFormatString="Search Google for '{0}'" DataNavigateUrlFields="CompanyName" 
                        UniqueName="GridHyperLinkColumn1" DataNavigateUrlFormatString="http://www.google.com/search?hl=en&q={0}&btnG=Google+Search" 
                        DataTextField="CompanyName"
</telerik:GridHyperLinkColumn> 

C#:
 
 protected
 void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridDataItem) 
        { 
            GridDataItem item = (GridDataItem)e.Item; 
            if (item["CompanyName"].Text == "&nbsp;"
            { 
                HyperLink link1 = (HyperLink)item["GridHyperLinkColumn1"].Controls[0]; 
                link1.Visible = false
            } 
                        
         } 
    } 

Regards,
Shinu.




Tags
Grid
Asked by
Kieran
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or