TemplateColumn, HyperLink and &Amp

Discussion in 'ASP .Net Datagrid Control' started by Versteijn, Oct 20, 2004.

  1. Versteijn

    Versteijn Guest

    Hello all,

    I have a TemplateColumn, and a GetLink method, like below. In my
    links, however, the & for the parameters gets converted to &. That
    is definitely not what I want. What can I do about this?

    My actual link contains more fields from the database, so using
    HyperlinkColumn is not an option I guess.

    Thank you.

    Regards,

    David van Leerdam



    <asp:TemplateColumn SortExpression="Price" HeaderText="Price">
    <ItemTemplate>
    <asp:HyperLink runat="server" Text='<%# DataBinder.Eval(Container,
    "DataItem.Price", "{0:C}") %>' NavigateUrl='<%#
    getLink(CInt(DataBinder.Eval(Container, "DataItem.ProductID"))) %>'
    Target="_self"></asp:HyperLink>
    </ItemTemplate>

    GetLink looks like this:

    Public Function getLink(ByVal productid As Integer) As String
    Dim Url As String

    If Request("mode") = 2 Then
    Url = String.Format("productdetail.aspx?product={0}",
    productid)
    Else
    Url = String.Format("productdetail.aspx?test={0}",
    productid)
    End If

    Return Url
    End Function
    Versteijn, Oct 20, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DC Gringo
    Replies:
    3
    Views:
    6,100
    mikeb
    Aug 19, 2004
  2. FoundThisOnline

    &amp; problem with hyperlink control

    FoundThisOnline, Oct 11, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    2,859
    FoundThisOnline
    Oct 11, 2005
  3. Lemming
    Replies:
    3
    Views:
    428
    Lemming
    Oct 20, 2004
  4. Thomas Scheffler

    XALAN and &amp; in links

    Thomas Scheffler, Jan 5, 2005, in forum: XML
    Replies:
    0
    Views:
    389
    Thomas Scheffler
    Jan 5, 2005
  5. Tony

    & and &amp;

    Tony, May 4, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    427
    Michael Nemtsev
    May 4, 2007
Loading...

Share This Page