Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataGrid: Navigate URL 2

Status
Not open for further replies.

overDeveloper

Programmer
Dec 11, 2006
58
US
In a datagrid I have a column type HyperLink - I want the Navigate URL to be dynamic as in:

page.aspx?id=<%=Request["var"]%>

How would I do this?
 
You could use String.Format and bind the results from your datasource.

Code:
<asp:HyperLink id="hlgglSearch" runat="server" NavigateUrl='<%# String.Format("[URL unfurl="true"]http://www.google.com/search?hl=en&q={0}",DataBinder.Eval(Container.DataItem,"SearchString"))%>'>Search[/URL] Google</asp:HyperLink>
 
Or you could simply use a HyperLinkColumn and set it's DataNavigateUrlFormatString.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top