Lets say you have a datagrid with a hyperlink on each row that points to somewhere.com?id=xxxx, where the ID is part \
of the dataset.

Usually what I would do is add in the hyperlink NavigationURL in the .vb codebehind in the grid_ItemDataBound function \
like

        '##### Tracker Copies Grid
        Protected Sub grdCopies_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdCopies.ItemDataBound
            Select Case e.Item.ItemType
                Case ListItemType.AlternatingItem, ListItemType.Item
                    'Set the hyperlink for the related tracker ID
                    Dim lnkCopiesTrackerNum As HyperLink = CType(e.Item.FindControl("lnkCopiesTrackerNum"), HyperLink)
                    lnkCopiesTrackerNum.NavigateUrl = "trackerInfo.aspx?trackerNum=" & lnkCopiesTrackerNum.Text
            End Select
        End Sub

But since the ID is already in the dataset, a simple container.dataitem("ID") in the ASPX html code will work \
fine. The problem I had was concatenating standard text with <%# aspVariable %>

The solution is to use string.concat (or double quotes)

This is what I tried (which failed)



This is what worked!



This also works! (thanks jarnold)



For More complex string, try this

...
NavigateUrl='<%# string.format("{0}{1}{2}", "javascript:ReturnToParentPage(", Eval("image_id"), ")") %>'
This produces NavigateUrl='javascript:ReturnToParentPage(23)'

or

NavigateUrl='<%# string.format("{0}{1}{2}{3}{4}", "javascript:ReturnToParentPage(", Eval("image_id"), ",""", Eval("path"), """)") %>'
Which produces NavigateUrl='javascript:ReturnToParentPage(23,"imagename.jpg")'