problems with databinding syntax

BulaiaAratyme

New Member
Hi,<BR><BR>This is my databinding syntax for html <a> tag:<BR><A href=http://aspmessageboard.com/archive/index.php/"http://<%# DataBinder.Eval(Container.DataItem, "Url1") %>" target="_blank"></A><BR>This code binds ok.<BR><BR>However this code for my server run ASP:HyperLink does not work ok:<BR><ASP:HyperLink id="Url1" Text="More" NavigateUrl='http://<%# DataBinder.Eval(Container.DataItem, "Url1") %>' target="_blank" runat="server" /><BR><BR>The problem is with http:// in NavigateUrl property. If I remove it, the code binds ok. If I leave it there, the code still works but does not bind.<BR>What can I do to make this work? I would also like to use other html tags in Text or NavigateUrl properties of some server controls.<BR><BR>Hope you can help me<BR>MareOf all the ways to achieve this, the simplest is probably to do the following:<BR><BR>Your ServerControl:<BR><ASP:HYPERLINK ID="Url1" TEXT="More" NAVIGATEURL='<%# fnGetURL(CType(DataBinder.Eval(Container.DataItem, "Url1"), String)) %>' TARGET="_blank" RUNAT="server" /><BR><BR><BR>The fnGetURL Function:<BR><BR> Protected Function fnGetURL(ByVal linkString As String) As String<BR> Return "http://whatever/" & linkString<BR> End Functionthanks that helped!
 
Back
Top