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. Advertisements

  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. Advertisements

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:
    441
    Chris Jackson
    Aug 28, 2003
  2. Guest
    Replies:
    3
    Views:
    392
    Martin Dechev
    Apr 6, 2004
  3. Dexter
    Replies:
    1
    Views:
    569
    Eliyahu Goldin
    Jan 18, 2005
  4. Ken Varn
    Replies:
    1
    Views:
    1,111
    Ken Varn
    Aug 19, 2005
  5. Charleees
    Replies:
    2
    Views:
    8,518
    Eliyahu Goldin
    Jun 20, 2006
  6. Ravichandran Mahalingam

    Bound Column or Template Column (w dAdapater?) in DataGrid

    Ravichandran Mahalingam, Jan 9, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    394
    Ravichandran Mahalingam
    Jan 9, 2004
  7. Esperanza

    Template column base on another column value

    Esperanza, Feb 18, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    5
    Views:
    341
    Elton Wang
    Feb 21, 2005
  8. Replies:
    2
    Views:
    386
    jyoti
    Aug 19, 2006
Loading...