Simple question

Discussion in 'ASP .Net Datagrid Control' started by Gary, Aug 19, 2003.

  1. Gary

    Gary Guest

    Hi,
    I have 7 columns on my datagrid, out of which one column (Column No 1) is
    hidden (which is containing User ID), and the Column No 3 is displaying user
    Name.
    Now I have given hyperlink on Column no 3 (i.e User Name) & I want to pick
    up the data from Column no 1 (i.e User ID) when I click the hyperlink.

    Please let me know how this can be done.

    TIA,
    Gary
    Gary, Aug 19, 2003
    #1
    1. Advertising

  2. Gary

    ASP.NET Guest

    are you using the SelectedIndexChanged event? try something like this (C#):

    int userID = (int) myDataGrid.DataKeys[myDataGrid.SelectedIndex];

    This assumes you have set the DataKeyField property of your grid. Think of
    DataKeys as your collection of IDs, one ID per row.

    Regards,
    Stephen

    "Gary" <> wrote in message
    news:eCUB$...
    > Hi,
    > I have 7 columns on my datagrid, out of which one column (Column No 1) is
    > hidden (which is containing User ID), and the Column No 3 is displaying

    user
    > Name.
    > Now I have given hyperlink on Column no 3 (i.e User Name) & I want to pick
    > up the data from Column no 1 (i.e User ID) when I click the hyperlink.
    >
    > Please let me know how this can be done.
    >
    > TIA,
    > Gary
    >
    >
    ASP.NET, Aug 19, 2003
    #2
    1. Advertising

  3. How does your HyperlinkColumn look like
    In case its
    <asp:HyperLinkColumn HeaderText="UserName" DataNavigateUrlField="ID"
    DataNavigateUrlFormatString="link.aspx?ID={0}"
    DataTextField="UserName"></asp:HyperLinkColumn>
    </Columns>

    You can give the DataNavigateURL Field as Column 1 and DataTextField as column 3
    In case of retrieving it you can use
    Request.QueryString("ID")




    "Gary" <> wrote in message news:eCUB$...
    > Hi,
    > I have 7 columns on my datagrid, out of which one column (Column No 1) is
    > hidden (which is containing User ID), and the Column No 3 is displaying user
    > Name.
    > Now I have given hyperlink on Column no 3 (i.e User Name) & I want to pick
    > up the data from Column no 1 (i.e User ID) when I click the hyperlink.
    >
    > Please let me know how this can be done.
    >
    > TIA,
    > Gary
    >
    >
    Sonali.NET[MVP], Aug 19, 2003
    #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. Replies:
    0
    Views:
    543
  2. Kevin Spencer

    Re: Simple Simple question!!!

    Kevin Spencer, Jun 25, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    646
    Kevin Spencer
    Jun 25, 2004
  3. Daniel Frey

    Simple Question - Simple Answer?

    Daniel Frey, Dec 28, 2004, in forum: XML
    Replies:
    4
    Views:
    822
    Daniel Frey
    Jan 12, 2005
  4. Oli

    simple simple question

    Oli, Jan 26, 2004, in forum: ASP General
    Replies:
    10
    Views:
    359
    Roland Hall
    Jan 26, 2004
  5. Peter Bailey

    simple, simple array question

    Peter Bailey, Apr 8, 2008, in forum: Ruby
    Replies:
    7
    Views:
    199
    Peter Bailey
    Apr 8, 2008
Loading...

Share This Page