locked
Templated List and dynamic Hyperlinks? RRS feed

  • Question

  • User1622957740 posted

    Ok, so managed to get the List to work now. Next question is how do I get the Link control to dynamically render a link Id within the template?

    <mobile:List ID="OrderList" Runat="server">

    <DeviceSpecific>

    <Choice Xmlns="http://schemas.microsoft.com/mobile/html32template">

    <ItemTemplate>

    <mobile:Link runat=server NavigateUrl='ShowInvoice.aspx?Id=<%# Eval("pk") %>' BreakAfter=True > <%# Eval("Company") %></mobile:Link>

    <mobile:Label runat=server><%# Eval("Firstname") %> <%#Eval("Lastname") %></mobile:Label>

    ...

    <br/>

    </ItemTemplate>

    </Choice>

    </DeviceSpecific>

    </mobile:List>

    The above doesn't work as ASP.NET doesn't want to eval the embedded databinding expression in the link field:

    <mobile:Link runat=server NavigateUrl='ShowInvoice.aspx?Id=<%# Eval("pk") %>' BreakAfter=True > <%# Eval("Company") %></mobile:Link>

    The only way i can see this work is in code. In fact, after farting around with this for a while it looks like it's actually easier to do this in code anyway, but it oughta be possible to do this declaratively somehow?

    +++ Rick ---

     

    Tuesday, May 24, 2005 6:12 AM

All replies

  • User664499748 posted

    Try the following 

    <mobile:Link runat=server NavigateUrl='<%# "ShowInvoice.aspx?Id=" + Eval("pk") %>' BreakAfter=True > <%# Eval("Company") %></mobile:Link>

    Hope that helps,
    Kashif

     

    Sunday, September 11, 2005 10:20 PM