Add javascript to NavigateURL

I am trying to add a javascript to my Navigate URL n the code behind:

((HyperLink)e.Row.FindControl("hypViewObject")).NavigateUrl = "javascript:popup('" + (string)DataBinder.Eval(e.Row.DataItem, "AddedBy") + "');";

this doesn’t work. I have hard coded into the NavigateURL on the actual page (with a hardcoded variable for the javascript) and it works fine.

Any ideas?



Try using an HtmlAnchor control instead of a hyperlink. Then set the HRef property

Or keep your javascripts on the client side and bind things to events . . …

Really helps if you target the right control! Copy & Paste lines of code can have it’s down side :blush:

wwb_99 - any chance you could take a look at: