Embedding variables in ASP.NET presentation layer

Once again I pull my hair out over the simplest things!

So, I declare a variable in the code thus:

    Dim cartCounter As Integer = 10

and then try and embed it in a hyperlink thus:

<asp:HyperLink ID="hl_editBasket" NavigateUrl="editBasket.aspx" runat="server">Edit Basket [<%#cartCounter%>]</asp:HyperLink>

No error, nothing displayed!   Agggghhhhhhhhh

Please help guys and gals.
jammy-d0dgerAsked:
Who is Participating?
 
NazoUKConnect With a Mentor Commented:
Change [<%#cartCounter%>] to [<%=cartCounter%>]

# is for databinding expressions <%= is a shortcut for response.write which prints out a string which is what you want to do here
0
 
jammy-d0dgerAuthor Commented:
Now that is downright embarassing.  It didn't even occur to me to use the same method as for classic ASP!  DOH!

Many thanks for that :)
0
All Courses

From novice to tech pro — start learning today.