Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7752671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:51:26+00:00 2026-06-01T11:51:26+00:00

I have a GridView on a .aspx page with a hidden column which has

  • 0

I have a GridView on a .aspx page with a hidden column which has an ID value. When the user clicks on a certain row, I need the ID column value on the C# code behind, so that I can query the database and populate another view with data corresponding to this ID. My problem is, I can pass this ID value to a javascript function in the onClick event of the row, but how do I get it to the code behind from where I can actually query the SQL Server database?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:51:27+00:00Added an answer on June 1, 2026 at 11:51 am

    This is how I solved it –

    Got the selected row index with –
    e.Row.Attributes[“onclick”] = ClientScript.GetPostBackClientHyperlink(this.GridView2, “Select$” + e.Row.RowIndex);

    In the SelectedIndexChanged event of the Grid –
    GridView2.SelectedRowStyle.BackColor = System.Drawing.Color.LightGray;
    string id = GridView2.SelectedRow.Cells[0].Text;

    Where, Cells[0] was my hidden column which contains the ID value

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my aspx page I have a gridview which displays the value from my
I have an aspx page which has a GridView and a Panel with Summary
In my .aspx page, I have an <asp:GridView runat=server ID=CustomerGridView> control which I bind
I have a aspx page that has a GridView with a datasource of an
Basically in my in my aspx page I have a gridview which displays the
I have a gridview in an aspx page with c# code behind. Is there
I have a GridView on my aspx page which displays a collection of objects
I have a gridview on an aspx page. the gridview already has a datasource
I have asp.net's .aspx page. that have GridView let say GridViewParent and Each row
I have an aspx page that has a control which serves as a summary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.