title: gridview on select row event
body: <p>How do I do a grdiview on select row event?  On the source page, I added</p>
  
  <pre><code>    OnSelectedIndexChanged="grdTanks_OnSelectRow"
  </code></pre>
  
  <p>in the code behind, I put the function</p>
  
  <pre><code>        protected void grdTanks_OnSelectRow(Object sender, GridViewCommandEventArgs e)
          {
  
          }
  </code></pre>
  
  <p>When I try to do it that way, I get No overload for grdTanks_OnSelectRow matches delegate 'System.EventHandler'</p>
  
  <p>If I change the GridViewComandEventArgs to EventArgs, then it won't allow me to do </p>
  
  <pre><code>    if (e.CommandName == "Select")
  </code></pre>
  
  <p>anybody know how to do a OnSelectRow event for a gridview?  Thanks</p>
  
  <p>I also added this code:</p>
  
  <pre><code>        protected void grdTanks_RowDataBound(Object sender, GridViewRowEventArgs e)
  {
      if (e.Row.RowType == DataControlRowType.DataRow)
      {
          if (e.Row.RowIndex != -1)
          {
              e.Row.Attributes["onmouseover"] = "this.style.cursor='hand';this.style.background='#3260a0';;this.style.color='white'";
              if (e.Row.RowIndex % 2 == 1)
              {
                  e.Row.Attributes["onmouseout"] = "this.style.textDecoration='none';this.style.background='white';this.style.color='black'";
              }
              else
              {
                  e.Row.Attributes["onmouseout"] = "this.style.textDecoration='none';this.style.background='#bEc8bE';this.style.color='black'";
              }
  
              e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this.grdTanks, "Select$" + Convert.ToString(DataBinder.Eval(e.Row.DataItem, "CargoTankID")));
          }
      }
  
  }
  </code></pre>