R
Ronald Moolenaar
Hi,
I have found many postings where people wanted something like:
<asp:HyperLink NavigateUrl="javascript:MyFunction('<%#
DataBinder.Eval(Container.DataItem, "NeedComments") %>')"
RunAt="server">
</asp:HyperLink>
The problem seems to be that the DataBinding needs both ' and ", and
the rest of the stuff in NavigateUrl cannot contain another
apostrophe.
Proposed solutions in code behind will probably work, but when the
HyperLink is in an ItemTemplate of a DataList, I think it will be
difficult to do. After much struggling I found the following 'not code
behind' solution:
NavigateUrl='<%# String.Concat("javascript
isplayInternetPage(", new
String((char)39, 1), DataBinder.Eval(Container.DataItem, "URL"), new
String((char)39, 1), ")") %>'
Cheers,
Ronald
I have found many postings where people wanted something like:
<asp:HyperLink NavigateUrl="javascript:MyFunction('<%#
DataBinder.Eval(Container.DataItem, "NeedComments") %>')"
RunAt="server">
</asp:HyperLink>
The problem seems to be that the DataBinding needs both ' and ", and
the rest of the stuff in NavigateUrl cannot contain another
apostrophe.
Proposed solutions in code behind will probably work, but when the
HyperLink is in an ItemTemplate of a DataList, I think it will be
difficult to do. After much struggling I found the following 'not code
behind' solution:
NavigateUrl='<%# String.Concat("javascript

String((char)39, 1), DataBinder.Eval(Container.DataItem, "URL"), new
String((char)39, 1), ")") %>'
Cheers,
Ronald