Multiple Parameters With Hyperlink in DataGrid

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default Multiple Parameters With Hyperlink in DataGrid

    I have a datagrid with a hyperlinkcontrol column. And it will only take one
    parameter. So I created a template column, with a hyperlink based on an
    example I saw. (now working directly in the aspx page as opposed to the code
    behind) It uses the NavigateURL and then useses
    Container.DataItem("itemName") to set the item values inline (so
    'someUrl.com?item=.' + Container.DataItem("itemName") ) First off I'm doing
    this in C# so I changed the call to Container.DataItem["itemName"]. Now it
    throwsa HTML excepetion because the "object" cannot be index. any
    suggestions on how to do this. I have tried casting the container but to no
    avail.

    My overall goal is to pass 2 parameters in a query string of a hyperlink
    that is embeded in a datagrid. :)

    THANKS!!
    eRic


    eRic Guest

  2. Similar Questions and Discussions

    1. Multiple (Duplicate) Hyperlink Issue
      Did you ever solve the problem? I have several sources that I want to link to the same (URL) destination. It seems that each one has to have its...
    2. ASP - Multiple URL Parameters ?? Howto
      Using DWMX and ASP, how can I take advantage of multiple URL parameters? For example, I'd like to pass both the month and day as:...
    3. DataGrid HyperLink Column - How can I put multiple fields in the URL field
      Hi everyone, How can I put multiple fields in the Datagrid Hyperlink Colume - URL FIELD ? I need to buidl an URL like: ...
    4. pass 2 parameters using HyperLink column?
      is it possible? thanks TIA.
    5. Passing multiple values accross a hyperlink ?
      Hi, I have a link as follows: <A HREF=""Tracker.asp?MovementID=" & RS("MovementID") & " PONumber=" & RS("PONumber") & """>" & RS("MovementID")...
  3. #2

    Default Re: Multiple Parameters With Hyperlink in DataGrid

    Hi Eric,

    Could you post a code snippet along with the exact text for the error?

    --
    Victor Garcia Aprea
    Microsoft MVP | ASP.NET
    Looking for insights on ASP.NET? Read my blog:
    [url]http://obies.com/vga/blog.aspx[/url]

    To contact me remove 'NOSPAM'. Please post all questions to the newsgroup

    and not by private mail.
    "eRic" <ezadler@hotmail.com> wrote in message
    news:eZqQzunRDHA.2008@TK2MSFTNGP11.phx.gbl...
    > I have a datagrid with a hyperlinkcontrol column. And it will only take
    one
    > parameter. So I created a template column, with a hyperlink based on an
    > example I saw. (now working directly in the aspx page as opposed to the
    code
    > behind) It uses the NavigateURL and then useses
    > Container.DataItem("itemName") to set the item values inline (so
    > 'someUrl.com?item=.' + Container.DataItem("itemName") ) First off I'm
    doing
    > this in C# so I changed the call to Container.DataItem["itemName"]. Now
    it
    > throwsa HTML excepetion because the "object" cannot be index. any
    > suggestions on how to do this. I have tried casting the container but to
    no
    > avail.
    >
    > My overall goal is to pass 2 parameters in a query string of a hyperlink
    > that is embeded in a datagrid. :)
    >
    > THANKS!!
    > eRic
    >
    >

    Victor Garcia Aprea [MVP] Guest

  4. #3

    Default Re: Multiple Parameters With Hyperlink in DataGrid


    "Victor Garcia Aprea [MVP]" <vga@NOobiesSPAM.com> wrote in message
    news:OYBZrXASDHA.2460@TK2MSFTNGP10.phx.gbl...
    [borrowing Victor's post because I lost the original on my newsspool]
    > "eRic" <ezadler@hotmail.com> wrote in message
    > news:eZqQzunRDHA.2008@TK2MSFTNGP11.phx.gbl...
    > > I have a datagrid with a hyperlinkcontrol column. And it will only take
    > one
    > > parameter. So I created a template column, with a hyperlink based on an
    > > example I saw. (now working directly in the aspx page as opposed to the
    > code
    > > behind) It uses the NavigateURL and then useses
    > > Container.DataItem("itemName") to set the item values inline (so
    > > 'someUrl.com?item=.' + Container.DataItem("itemName") ) First off I'm
    > doing
    > > this in C# so I changed the call to Container.DataItem["itemName"]. Now
    > it
    > > throwsa HTML excepetion because the "object" cannot be index. any
    > > suggestions on how to do this. I have tried casting the container but
    to
    > no
    > > avail.
    > >
    > > My overall goal is to pass 2 parameters in a query string of a hyperlink
    > > that is embeded in a datagrid. :)
    Just as a note...

    It might be a little bit cheesy, but why not build the query string for each
    row in SQL (something like like SELECT 'item1=' + item1 + '&item2=' + item2
    AS QueryString) and then use that in your datagrid?



    --
    Dave Rothgery
    [email]drothgery@alum.wpi.edu[/email]


    David Rothgery Guest

  5. #4

    Default Re: Multiple Parameters With Hyperlink in DataGrid

    Hi eRic

    Forgetting about template columns for the time being, I think the following
    should work for you:

    <asp:HyperLinkColumn DataNavigateUrlField="itemName"
    DataNavigateUrlFormatString="someUrl.com?item={0}"
    DataTextField="itemName"></asp:HyperLinkColumn>

    HTH
    Joe

    "eRic" <ezadler@hotmail.com> wrote in message
    news:eZqQzunRDHA.2008@TK2MSFTNGP11.phx.gbl...
    > I have a datagrid with a hyperlinkcontrol column. And it will only take
    one
    > parameter. So I created a template column, with a hyperlink based on an
    > example I saw. (now working directly in the aspx page as opposed to the
    code
    > behind) It uses the NavigateURL and then useses
    > Container.DataItem("itemName") to set the item values inline (so
    > 'someUrl.com?item=.' + Container.DataItem("itemName") ) First off I'm
    doing
    > this in C# so I changed the call to Container.DataItem["itemName"]. Now
    it
    > throwsa HTML excepetion because the "object" cannot be index. any
    > suggestions on how to do this. I have tried casting the container but to
    no
    > avail.
    >
    > My overall goal is to pass 2 parameters in a query string of a hyperlink
    > that is embeded in a datagrid. :)
    >
    > THANKS!!
    > eRic
    >
    >

    Joe Glover Guest

  6. #5

    Default Re: Multiple Parameters With Hyperlink in DataGrid

    Yeah, adding 1 parameter to the query string is straight forward,
    unfortuately I was trying to add at least 2 parameters. That's why I
    needed the template column and the hyperlink control

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Eric Adler Guest

  7. #6

    Default Re: Multiple Parameters With Hyperlink in DataGrid


    Shoot I wish I had captured the error better. I had a tight deadline so
    I need came up with a different solution. One where I only needed the
    one, easy, query string value. So, in your opinion, was I on the right
    track?


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Eric Adler Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139