Noob question - Need variable from DB field

Discussion in 'ASP .Net' started by Arch Stanton, Feb 27, 2008.

  1. Arch Stanton

    Arch Stanton Guest

    I have some data returned via a SQL statement (from MS Access) to a
    datagrid on an ASPX page. One of my datagrid columns is a hyperlink
    column. Everything works fine, but I need to pass the variable my user
    clicks to another page.

    Here's the code for my hyperlink column:

    <asp:hyperlinkcolumn
    datatextfield="SiteID"
    headertext="Site ID"
    datanavigateurlfield="SiteID"
    datanavigateurlformatstring="CTSingleSite.aspx?SiteID=12-236" />

    This code passes the string "12-236" to the receiving page just great,
    but I need to replace that string with the string variable "SiteID" used
    in this tag. I tried this:

    datanavigateurlformatstring= _
    "CTSingleSite.aspx?SiteID= '" & SiteID & "'"

    But this causes an error. How can I pass the actual variable value, not
    a hard-coded value?

    Thanks much for any help.
     
    Arch Stanton, Feb 27, 2008
    #1
    1. Advertising

  2. datanavigateurlformatstring="CTSingleSite.aspx?SiteID={0}"

    --
    Eliyahu Goldin,
    Software Developer
    Microsoft MVP [ASP.NET]
    http://msmvps.com/blogs/egoldin
    http://usableasp.net


    "Arch Stanton" <> wrote in message
    news:...
    >I have some data returned via a SQL statement (from MS Access) to a
    >datagrid on an ASPX page. One of my datagrid columns is a hyperlink column.
    >Everything works fine, but I need to pass the variable my user clicks to
    >another page.
    >
    > Here's the code for my hyperlink column:
    >
    > <asp:hyperlinkcolumn
    > datatextfield="SiteID"
    > headertext="Site ID"
    > datanavigateurlfield="SiteID"
    > datanavigateurlformatstring="CTSingleSite.aspx?SiteID=12-236" />
    >
    > This code passes the string "12-236" to the receiving page just great, but
    > I need to replace that string with the string variable "SiteID" used in
    > this tag. I tried this:
    >
    > datanavigateurlformatstring= _
    > "CTSingleSite.aspx?SiteID= '" & SiteID & "'"
    >
    > But this causes an error. How can I pass the actual variable value, not a
    > hard-coded value?
    >
    > Thanks much for any help.
     
    Eliyahu Goldin, Feb 27, 2008
    #2
    1. Advertising

  3. Arch Stanton

    Arch Stanton Guest

    Party. Thanks a million, EG.


    Eliyahu Goldin wrote:
    > datanavigateurlformatstring="CTSingleSite.aspx?SiteID={0}"
    >
     
    Arch Stanton, Feb 27, 2008
    #3
    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. administrata

    [NooB] a Variable in multiple quotes...

    administrata, Feb 13, 2005, in forum: Python
    Replies:
    7
    Views:
    353
    Fredrik Lundh
    Feb 14, 2005
  2. BlueHandTalking

    NOOB Question on Instance Variable

    BlueHandTalking, Jan 12, 2010, in forum: Ruby
    Replies:
    12
    Views:
    171
    Seebs
    Jan 14, 2010
  3. cayenne
    Replies:
    19
    Views:
    681
    John W. Krahn
    May 20, 2004
  4. Sound
    Replies:
    2
    Views:
    498
    Randy Webb
    Sep 28, 2006
  5. jr
    Replies:
    3
    Views:
    491
Loading...

Share This Page