how to send two parameters in HyperLinkColumn?

Discussion in 'ASP .Net' started by sincethe2003, Oct 16, 2004.

  1. sincethe2003

    sincethe2003 Guest

    Hi, in the following example:
    -----------
    <asp:HyperLinkColum
    HeaderText="Select an Item"
    DataNavigateUrlField="IntegerValue"
    DataNavigateUrlFormatString="detailspage.aspx?id={0}"
    DataTextField="PriceValue"
    DataTextFormatString="{0:c}"
    Target="_blank"/>
    -----------
    there is only one parameter "id" to transmit,
    how do I send two parameters using HyperLinkColumn?
    sincethe2003, Oct 16, 2004
    #1
    1. Advertising

  2. sincethe2003

    Scott Allen Guest

    Hi sincethe2003:

    You could add script to actually perform the String.Format in ASPX:

    DataNavigateUrlFormatString=
    <%= String.Format("detailspage.aspx?id={0}", id); %>

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

    On Sun, 17 Oct 2004 04:49:32 +0800, "sincethe2003" <>
    wrote:

    >Hi, in the following example:
    >-----------
    ><asp:HyperLinkColum
    > HeaderText="Select an Item"
    > DataNavigateUrlField="IntegerValue"
    > DataNavigateUrlFormatString="detailspage.aspx?id={0}"
    > DataTextField="PriceValue"
    > DataTextFormatString="{0:c}"
    > Target="_blank"/>
    >-----------
    >there is only one parameter "id" to transmit,
    >how do I send two parameters using HyperLinkColumn?
    >
    Scott Allen, Oct 16, 2004
    #2
    1. Advertising

  3. sincethe2003

    sincethe2003 Guest

    how to send the second parameter?
    for example:
    <%= String.Format("detailspage.aspx?id={0}&name={1}", id, name);
    but this is not work....

    "Scott Allen" <bitmask@[nospam].fred.net> ¦b¶l¥ó
    news: ¤¤¼¶¼g...
    > Hi sincethe2003:
    >
    > You could add script to actually perform the String.Format in ASPX:
    >
    > DataNavigateUrlFormatString=
    > <%= String.Format("detailspage.aspx?id={0}", id); %>
    >
    > --
    > Scott
    > http://www.OdeToCode.com/
    > --
    > Scott
    > http://www.OdeToCode.com/blogs/scott/
    >
    > On Sun, 17 Oct 2004 04:49:32 +0800, "sincethe2003" <>
    > wrote:
    >
    > >Hi, in the following example:
    > >-----------
    > ><asp:HyperLinkColum
    > > HeaderText="Select an Item"
    > > DataNavigateUrlField="IntegerValue"
    > > DataNavigateUrlFormatString="detailspage.aspx?id={0}"
    > > DataTextField="PriceValue"
    > > DataTextFormatString="{0:c}"
    > > Target="_blank"/>
    > >-----------
    > >there is only one parameter "id" to transmit,
    > >how do I send two parameters using HyperLinkColumn?
    > >

    >
    sincethe2003, Oct 17, 2004
    #3
  4. sincethe2003

    Scott Allen Guest

    Are you getting an exception or???

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

    On Sun, 17 Oct 2004 18:47:42 +0800, "sincethe2003" <>
    wrote:

    >how to send the second parameter?
    >for example:
    ><%= String.Format("detailspage.aspx?id={0}&name={1}", id, name);
    >but this is not work....
    >
    >"Scott Allen" <bitmask@[nospam].fred.net> ¦b¶l¥ó
    >news: ¤¤¼¶¼g...
    >> Hi sincethe2003:
    >>
    >> You could add script to actually perform the String.Format in ASPX:
    >>
    >> DataNavigateUrlFormatString=
    >> <%= String.Format("detailspage.aspx?id={0}", id); %>
    >>
    >> --
    >> Scott
    >> http://www.OdeToCode.com/
    >> --
    >> Scott
    >> http://www.OdeToCode.com/blogs/scott/
    >>
    >> On Sun, 17 Oct 2004 04:49:32 +0800, "sincethe2003" <>
    >> wrote:
    >>
    >> >Hi, in the following example:
    >> >-----------
    >> ><asp:HyperLinkColum
    >> > HeaderText="Select an Item"
    >> > DataNavigateUrlField="IntegerValue"
    >> > DataNavigateUrlFormatString="detailspage.aspx?id={0}"
    >> > DataTextField="PriceValue"
    >> > DataTextFormatString="{0:c}"
    >> > Target="_blank"/>
    >> >-----------
    >> >there is only one parameter "id" to transmit,
    >> >how do I send two parameters using HyperLinkColumn?
    >> >

    >>

    >
    Scott Allen, Oct 17, 2004
    #4
  5. sincethe2003

    sincethe2003 Guest

    yes, it will cause error,
    because it seems only {0} is accepted, the second parameter using {1} will
    cause error .....



    "Scott Allen" <bitmask@[nospam].fred.net> ¦b¶l¥ó
    news: ¤¤¼¶¼g...
    > Are you getting an exception or???
    >
    > --
    > Scott
    > http://www.OdeToCode.com/
    >
    > On Sun, 17 Oct 2004 18:47:42 +0800, "sincethe2003" <>
    > wrote:
    >
    > >how to send the second parameter?
    > >for example:
    > ><%= String.Format("detailspage.aspx?id={0}&name={1}", id, name);
    > >but this is not work....
    > >
    > >"Scott Allen" <bitmask@[nospam].fred.net> ¦b¶l¥ó
    > >news: ¤¤¼¶¼g...
    > >> Hi sincethe2003:
    > >>
    > >> You could add script to actually perform the String.Format in ASPX:
    > >>
    > >> DataNavigateUrlFormatString=
    > >> <%= String.Format("detailspage.aspx?id={0}", id); %>
    > >>
    > >> --
    > >> Scott
    > >> http://www.OdeToCode.com/
    > >> --
    > >> Scott
    > >> http://www.OdeToCode.com/blogs/scott/
    > >>
    > >> On Sun, 17 Oct 2004 04:49:32 +0800, "sincethe2003" <>
    > >> wrote:
    > >>
    > >> >Hi, in the following example:
    > >> >-----------
    > >> ><asp:HyperLinkColum
    > >> > HeaderText="Select an Item"
    > >> > DataNavigateUrlField="IntegerValue"
    > >> > DataNavigateUrlFormatString="detailspage.aspx?id={0}"
    > >> > DataTextField="PriceValue"
    > >> > DataTextFormatString="{0:c}"
    > >> > Target="_blank"/>
    > >> >-----------
    > >> >there is only one parameter "id" to transmit,
    > >> >how do I send two parameters using HyperLinkColumn?
    > >> >
    > >>

    > >

    >
    sincethe2003, Oct 17, 2004
    #5
  6. sincethe2003

    Joe Fallon Guest

    This is a known limitation of the hyperlink column.
    It will only take 1 parameter.

    Try using a template column instead:
    ============================================================
    <asp:TemplateColumn SortExpression="mynumber" HeaderText="My Number">
    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
    <ItemStyle HorizontalAlign="Center"></ItemStyle>
    <ItemTemplate>
    <asp:Hyperlink id="hylMyNumber" runat="server"></asp:Hyperlink>
    </ItemTemplate>
    </asp:TemplateColumn>
    ============================================================

    Then in code behind you can use: (mColl is custom collection object.)
    ============================================================

    Private Sub dg1_ItemDataBound(ByVal sender As Object, ByVal e As
    DataGridItemEventArgs) Handles dg1.ItemDataBound

    If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType =
    ListItemType.AlternatingItem Then

    'need to take paging into account.
    Dim mIndex As Integer = CType(sender, DataGrid).PageSize *
    CType(sender, DataGrid).CurrentPageIndex + e.Item.ItemIndex

    Dim obj As HyperLink = CType(e.Item.FindControl("hylMyNumber"),
    HyperLink)
    obj .NavigateUrl = "javascript:LeftSideWin('ViewNum.aspx?Key=" &
    mColl(mIndex).key & "&KeyType=" & mColl(mIndex).type & "','MyWin');"
    obj .Text = mColl.(mIndex).mynumber

    End If

    End Sub
    ============================================================
    --
    Joe Fallon




    "sincethe2003" <> wrote in message
    news:...
    > Hi, in the following example:
    > -----------
    > <asp:HyperLinkColum
    > HeaderText="Select an Item"
    > DataNavigateUrlField="IntegerValue"
    > DataNavigateUrlFormatString="detailspage.aspx?id={0}"
    > DataTextField="PriceValue"
    > DataTextFormatString="{0:c}"
    > Target="_blank"/>
    > -----------
    > there is only one parameter "id" to transmit,
    > how do I send two parameters using HyperLinkColumn?
    >
    >
    Joe Fallon, Oct 17, 2004
    #6
    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. Dmitri Manushin

    send more than 1 parametr from hyperLinkColumn?

    Dmitri Manushin, Aug 13, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    595
    Dmitri Manushin
    Aug 13, 2003
  2. SStory
    Replies:
    3
    Views:
    2,418
    SStory
    Oct 30, 2003
  3. GenxLogic
    Replies:
    3
    Views:
    1,266
    andrewmcdonagh
    Dec 6, 2006
  4. Ron Clarke

    Parameters and the HyperLinkColumn

    Ron Clarke, Jan 29, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    112
    Ron Clarke
    Jan 29, 2004
  5. Gigino

    HyperLinkColumn and parameters

    Gigino, Jan 30, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    99
    Gigino
    Jan 30, 2004
Loading...

Share This Page