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

[Solved] GridHyperLinkColumn external parameter

1 Answer 193 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Liu Yan
Top achievements
Rank 1
Liu Yan asked on 05 Nov 2009, 03:20 AM
The Radgrid and Textbox in webform. I use GridHyperLinkColumn  on the radgrid, the grid has id, date, amount1, amount2 columns,
id columns are GridHyperLinkColumn, I want to click on id, but pass id and external parameter(textbox value) on the URL.

How to set DataNavigateUrlFormatString?

Thanks
LIUYAN

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 05 Nov 2009, 06:04 AM
Hello Liu,

You can try out the following code to pass an external parameter to the url when using a GridHyperLinkColumn:
c#:
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridDataItem) 
        { 
            GridDataItem dataItem = (GridDataItem)e.Item; 
            HyperLink link = (HyperLink)dataItem["HyperLinkColumnUniqueName"].Controls[0]; 
            link.Attributes.Add("onClick""Navigate(this);"); 
        }  
    } 

js:
function Navigate(hyperlink) 
    {     
      var textbox = document.getElementById("TextBox1"); 
      hyperlink.href = "Default2.aspx?text=" + textbox.value;       
    } 

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