0

I've tried to find a solution online, but I couldn't find any. However, it's probably easy to find if you know what to search for.

Anyway, I have a ASP.NET repeater like this:

  <asp:Repeater runat="server" ID="ToolRpt" SelectMethod="GetTools" ItemType="BtcDatabase.DbTools">
        <ItemTemplate>
            <div class="toolItem">
                <asp:HyperLink runat="server" NavigateUrl='~/tool/<%#Item.ToolUrl %>'>
                <h2><%# Item.ToolSubject %></h2>
                <%#Item.ToolSnippet %>
                    <br/><br/>
                <span style="text-decoration:underline">» Try the tool</span>
                </asp:HyperLink>
            </div>
        </ItemTemplate>
    </asp:Repeater>

My HyperLink navigate url is being output like this:

tool/%3C%25#Item.ToolUrl%20%25%3E

While I would like it to be the following when Item.ToolUrl is current-url:

tool/current-url

Anyone know the syntax when dealing with links?

(Sorry for nooby question - but this is seriously annoying)

Lars Holdgaard
  • 9,496
  • 26
  • 102
  • 182

1 Answers1

2

You should use Eval like this:

<asp:HyperLink runat="server" NavigateUrl='<%# "~/tool/"+ Eval("Item.ToolUrl")  %>'>
            <h2><%# Eval("Item.ToolSubject") %></h2>
            <%# Eval("Item.ToolSnippet") %>
                <br/><br/>
            <span style="text-decoration:underline">» Try the tool</span>
            </asp:HyperLink>
Amit Mittal
  • 1,129
  • 11
  • 30