Need some help with HyperLinkColumn!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Morten

    #1

    Need some help with HyperLinkColumn!

    Hi.

    After a while I finaly discovered how to use HyperLinkColumn s.
    What I can't find is how to send mote than one "value" like
    page.aspx?id1&i d2!!!

    <asp:HyperLinkC olumn DataNavigateUrl Field="InvoNo"
    DataNavigateUrl FormatString="I nvo.aspx?Id={0} " DataTextField=" InvoNo"
    HeaderText="Inv o No.">
    <HeaderStyle HorizontalAlign ="Left"></HeaderStyle>
    <ItemStyle HorizontalAlign ="Left"></ItemStyle>
    </asp:HyperLinkCo lumn>

    I also need to send: ID2=Request.Que ryString("custn o")
    ??
    Invo.aspx?Id={0 }&ID2=Request.Q ueryString("cus tno")


    Thanks...

    Morten


  • AW

    #2
    Re: Need some help with HyperLinkColumn !

    Hi Morten,

    Unfortunately, you can't use more than one column as a data source for an
    HyperLinkColumn .

    However, if the object that you're binding to your DataGrid is a DataTable,
    there's a trick: you can add a new computed column to the DataTable, and
    bind this column to your HyperLinkColumn .

    In your ASPX, write:
    <asp:HyperLinkC olumn DataNavigateUrl Field="InvoNo"
    DataNavigateUrl FormatString="I nvo.aspx?{0}" DataTextField=" Computed"
    HeaderText="Inv o No.">

    and in your CodeBehind, use:
    DataSet ds = new DataSet();

    sqlDataAdapter2 .Fill(ds);

    DataTable t = ds.Tables[0];

    DataColumn dc = new DataColumn("Com puted");

    dc.Expression=" Id=' + InvoNo + '&id2="+ Request.QuerySt ring("custno") + "'";

    t.Columns.Add(d c);

    DataGrid1.DataS ource=ds;

    DataGrid1.DataB ind();
    --
    To reply, remove a "l" before the @ sign.

    Arnaud Weil - MCT, MCSD.Net, MCAD.Net


    Comment

    • Morten

      #3
      Re: Need some help with HyperLinkColumn !

      Thanks AW.

      Could You please help me a bit more.

      My datagrid are filled like this.

      Dim aOpenPost As New OleDb.OleDbData Adapter("SELECT InvoNo, Dt,
      Am, CustNo FROM CustTr WHERE (CustNo = '" & AcNo & "' " & tmpDt & ")", cnn)
      Dim dsOpenPost As DataSet = New DataSet()
      aOpenPost.Fill( dsOpenPost, "CustTr")
      grdOpenPost.Dat aSource = dsOpenPost
      grdOpenPost.Dat aBind()


      :) Morten


      "AW" <aweill@fr.xrt. com> wrote in message
      news:em3q3NfoDH A.2776@tk2msftn gp13.phx.gbl...[color=blue]
      > Hi Morten,
      >
      > Unfortunately, you can't use more than one column as a data source for an
      > HyperLinkColumn .
      >
      > However, if the object that you're binding to your DataGrid is a[/color]
      DataTable,[color=blue]
      > there's a trick: you can add a new computed column to the DataTable, and
      > bind this column to your HyperLinkColumn .
      >
      > In your ASPX, write:
      > <asp:HyperLinkC olumn DataNavigateUrl Field="InvoNo"
      > DataNavigateUrl FormatString="I nvo.aspx?{0}" DataTextField=" Computed"
      > HeaderText="Inv o No.">
      >
      > and in your CodeBehind, use:
      > DataSet ds = new DataSet();
      >
      > sqlDataAdapter2 .Fill(ds);
      >
      > DataTable t = ds.Tables[0];
      >
      > DataColumn dc = new DataColumn("Com puted");
      >
      > dc.Expression=" Id=' + InvoNo + '&id2="+ Request.QuerySt ring("custno") +[/color]
      "'";[color=blue]
      >
      > t.Columns.Add(d c);
      >
      > DataGrid1.DataS ource=ds;
      >
      > DataGrid1.DataB ind();
      > --
      > To reply, remove a "l" before the @ sign.
      >
      > Arnaud Weil - MCT, MCSD.Net, MCAD.Net
      >
      >[/color]


      Comment

      • Morten

        #4
        Re: Need some help with HyperLinkColumn !

        After a tortal 'Read-down' og my pages and code I have reconsidered and done
        some redisign and found that Request.QuerySt ring("custno") belongs in a
        session variable.

        No more agony.

        Thank.



        "Morten" <mk intelle (no)> wrote in message
        news:3fa62120$1 @news.broadpark .no...[color=blue]
        > Hi.
        >
        > After a while I finaly discovered how to use HyperLinkColumn s.
        > What I can't find is how to send mote than one "value" like
        > page.aspx?id1&i d2!!!
        >
        > <asp:HyperLinkC olumn DataNavigateUrl Field="InvoNo"
        > DataNavigateUrl FormatString="I nvo.aspx?Id={0} " DataTextField=" InvoNo"
        > HeaderText="Inv o No.">
        > <HeaderStyle HorizontalAlign ="Left"></HeaderStyle>
        > <ItemStyle HorizontalAlign ="Left"></ItemStyle>
        > </asp:HyperLinkCo lumn>
        >
        > I also need to send: ID2=Request.Que ryString("custn o")
        > ??
        > Invo.aspx?Id={0 }&ID2=Request.Q ueryString("cus tno")
        >
        >
        > Thanks...
        >
        > Morten
        >
        >[/color]


        Comment

        Working...