title: How to implement full row selecting in GridView without select button?
body: <p>I'm implementing a feature that when the user press on any point in the row in a GridView the row will be selected instead of Select button.</p>
  
  <p><img src="https://i.stack.imgur.com/JeQQJ.png" alt="enter image description here"></p>
  
  <p>To implement that, I'm using the following code:</p>
  
  <pre><code>protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  {
      if (e.Row.RowType == DataControlRowType.DataRow)
      {
          // Set the hand mouse cursor for the selected row.
          e.Row.Attributes.Add("OnMouseOver", "this.style.cursor = 'hand';");
  
          // The seelctButton exists for ensuring the selection functionality
          // and bind it with the appropriate event hanlder.
          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>
  
  <p>With the code above, there are the following problems:</p>
  
  <ul>
  <li>This works fine only if I <code>EnableEventValidation</code> for the page is set to <code>false</code>.</li>
  <li>The <code>SelectedIndexChanged</code> is only fired just in case the <code>Grid.DataBind()</code> is called in <code>Page_Load</code> for the page (in every postback).</li>
  </ul>
  
  <p>Am I doing something wrong? Is there a better implementation?</p>
  
  <hr>
  
  <p><strong>Edit:</strong>
  When <code>EnableEventValidation</code> is set to <code>true</code>, the following error will appear:</p>
  
  <blockquote>
    <p>Invalid postback or callback argument.  Event validation is enabled using  in configuration or &lt;%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. </p>
  </blockquote>