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

  • SEARCH
  • Home
  • 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 8354273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:30:04+00:00 2026-06-09T09:30:04+00:00

I currently have a gridview that is populated via database through a c# method.

  • 0

I currently have a gridview that is populated via database through a c# method.

I wanted to know if there was a way to select the row when clicked anywhere on the row and not use the select button altogether. And then have the information from that row be sent back and populate another area on the webpage.

Is there a grid better than gridview for this? Should I outsource to jQuery? Or is gridview all I should need?

  • 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-09T09:30:05+00:00Added an answer on June 9, 2026 at 9:30 am

    what you need to do is develop a row-clickable GridView. Best bet is to follow the instructions in the link. If your okay with VB, you can go along that route. A user has also converted it into C#, its in the comments section. Ill include it incase you dont see it.

    Heres a link I have saved: http://aspadvice.com/blogs/joteke/archive/2006/01/07/14576.aspx

    using System; 
    using System.ComponentModel; 
    using System.Configuration; 
    using System.Web.UI; 
    using System.Web.UI.WebControls; 
    
    namespace CustomGridView 
    { 
     /// <summary> 
     /// Summary description for ClickableGridView 
     /// </summary> 
     public class ClickableGridView : GridView 
     { 
       public string RowCssClass 
       { 
         get 
         { 
           string rowClass = (string)ViewState["rowClass"]; 
           if (!string.IsNullOrEmpty(rowClass)) 
             return rowClass; 
           else 
             return string.Empty; 
         } 
         set 
         { 
           ViewState["rowClass"] = value; 
         } 
       } 
    
       public string HoverRowCssClass 
       { 
         get 
         { 
           string hoverRowClass = (string)ViewState["hoverRowClass"]; 
           if (!string.IsNullOrEmpty(hoverRowClass)) 
             return hoverRowClass; 
           else 
             return string.Empty; 
         } 
         set 
         { 
           ViewState["hoverRowClass"] = value; 
         } 
       } 
    
       private static readonly object RowClickedEventKey = new object(); 
    
       public event GridViewRowClicked RowClicked; 
       protected virtual void OnRowClicked(GridViewRowClickedEventArgs e) 
       { 
         if (RowClicked != null) 
           RowClicked(this, e); 
       } 
    
       protected override void RaisePostBackEvent(string eventArgument) 
       { 
         if (eventArgument.StartsWith("rc")) 
         { 
           int index = Int32.Parse(eventArgument.Substring(2)); 
           GridViewRowClickedEventArgs args = new GridViewRowClickedEventArgs(Rows[index]); 
           OnRowClicked(args); 
         } 
         else 
           base.RaisePostBackEvent(eventArgument); 
       } 
    
       protected override void PrepareControlHierarchy() 
       { 
         base.PrepareControlHierarchy(); 
    
         for (int i = 0; i < Rows.Count; i++) 
         { 
           string argsData = "rc" + Rows[i].RowIndex.ToString(); 
           Rows[i].Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(this, argsData)); 
    
           if (RowCssClass != string.Empty) 
             Rows[i].Attributes.Add("onmouseout", "this.className='" + RowCssClass + "';"); 
    
           if (HoverRowCssClass != string.Empty) 
             Rows[i].Attributes.Add("onmouseover", "this.className='" + HoverRowCssClass + "';"); 
         } 
       } 
     } 
    
     public class GridViewRowClickedEventArgs : EventArgs 
     { 
       private GridViewRow _row; 
    
       public GridViewRowClickedEventArgs(GridViewRow aRow) 
         : base() 
       { 
         _row = aRow; 
       } 
    
       public GridViewRow Row 
       { 
         get 
         { return _row; } 
       } 
     } 
    
     public delegate void GridViewRowClicked(object sender, GridViewRowClickedEventArgs args); 
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a gridview that allows you to select the row by clicking
I have a GridView control set up, populated from a database through the BL,
I currently have an asp:GridView that displays a few BoundFields and then one asp:TemplateField
Currently I have a DetailsView attached to a GridView. When you select an item
I currently have a GridView scrolling vertically, and everything works fine. But now that
I have a gridview that imports data from a remote database, this is working
I currently have a gridview that has an asp:ButtonField as one of the columns.
I have a gridview that could end up displaying about 5K records. I currently
I have a DataTable that I am creating and binding to a GridView. Currently
I currently have a gridview that is set up and working properly but I

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.