Mulitple datafields in a template column

Discussion in 'ASP .Net' started by =?Utf-8?B?c29ubnk=?=, Apr 14, 2004.

  1. Hi folks

    This is what I would like to do

    <asp:TemplateColumn HeaderText="Purchase Order"><ItemTemplate><asp:HyperLink
    runat="server"
    Text='<%# DataBinder.Eval(Container, "DataItem.ID1") %>'
    NavigateUrl='page.aspx?var1='<%# DataBinder.Eval(Container, "DataItem.ID1") %>'var2='<%# DataBinder.Eval(Container, "DataItem.ID2") %
    ID="Hyperlink1"></asp:HyperLink></ItemTemplate></asp:TemplateColumn

    What I want to do is build a Hyperlink with 2 variables from the dataset, not just one. Can something like this be done

    thx...sonny
    =?Utf-8?B?c29ubnk=?=, Apr 14, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?c29ubnk=?=

    Scott Allen Guest

    You are very close, but you probably found out the TemplateColumn does
    not have a NavigateUrl property. One solution is to add an anchor tag
    yourself:

    <asp:TemplateColumn HeaderText="PurchaseOrder">
    <ItemTemplate>
    <a href='page.aspx?
    param1= <%#DataBinder.Eval(Container.DataItem,"ID1")%>
    &param2=<%#DataBinder.Eval(Container.DataItem, "ID2")%>'>
    <%#DataBinder.Eval(Container.DataItem, "ID1")%>
    </a>
    </ItemTemplate>
    </asp:TemplateColumn>

    HTH,

    --
    Scott
    http://www.OdeToCode.com

    On Wed, 14 Apr 2004 07:56:03 -0700, "sonny"
    <> wrote:

    >Hi folks,
    >
    >This is what I would like to do:
    >
    ><asp:TemplateColumn HeaderText="Purchase Order"><ItemTemplate><asp:HyperLink
    > runat="server"
    > Text='<%# DataBinder.Eval(Container, "DataItem.ID1") %>'
    > NavigateUrl='page.aspx?var1='<%# DataBinder.Eval(Container, "DataItem.ID1") %>'var2='<%# DataBinder.Eval(Container, "DataItem.ID2") %>
    > ID="Hyperlink1"></asp:HyperLink></ItemTemplate></asp:TemplateColumn>
    >
    >What I want to do is build a Hyperlink with 2 variables from the dataset, not just one. Can something like this be done?
    >
    >thx...sonny
    Scott Allen, Apr 14, 2004
    #2
    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. Joe Reazor

    Viewstate and Mulitple Web Servers

    Joe Reazor, Aug 28, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    339
    Chris Jackson
    Aug 28, 2003
  2. James X. Li
    Replies:
    1
    Views:
    395
    Jerry Boone
    Jan 2, 2004
  3. Guest
    Replies:
    3
    Views:
    329
    Martin Dechev
    Apr 6, 2004
  4. Molly J. Fagan

    Forms authentication/mulitple web projects

    Molly J. Fagan, Jun 17, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    449
    Oleg Ogurok
    Jun 20, 2004
  5. Martin
    Replies:
    2
    Views:
    370
    Martin
    Jun 20, 2004
Loading...

Share This Page