title: Simple Selecting a row from gridview in asp.net web application
body: <p>I know this question had been asked a hundred times, but I have difficulties implementing different solutions.I need to retrieve a selected row from a grid view in asp.net web application C#.I've done the databinding.I don't want to use edit/update buttons or checkboxe/radio button, just to select it by clicking on the row.Please help, I'm a little stuck, and I would like not to implement javascript based solutions.Thanks.</p>
  
  <pre><code>if (e.Row.RowType == DataControlRowType.DataRow)
          {
              e.Row.Attributes.Add("OnMouseOver", "this.style.cursor='pointer';this.style.textDecoration='underline';");
              e.Row.Attributes["onmouseout"] = "this.style.textDecoration='none';";
              e.Row.ToolTip = "Click on select row";
              e.Row.Attributes["OnClick"] = Page.ClientScript.GetPostBackClientHyperlink(this.SingleSelectGrid, "Select$" + e.Row.RowIndex);
  
  
              LinkButton selectbutton = new LinkButton()
              {
                  CommandName = "Select",
                  Text = e.Row.Cells[0].Text
              };
              e.Row.Cells[0].Controls.Add(selectbutton);
              e.Row.Attributes["OnClick"] = Page.ClientScript.GetPostBackClientHyperlink(selectbutton, "");
  
  
          }
  </code></pre>