title: GridView (e.Row.RowState & DataControlRowState.Edit) > 0 Not working
body: <p>What I'm looking to do is, on hitting the Edit button of my gridview, I want to change the propertys of some of the EditItemTemplate controls, based on what has been put in.  However the changes haven't been occuring, and after some debugging, I've determined that the code isn't going past the test for whether a row is in edit mode.  </p>
  
  <p>So after doing some research, I was told by numerous sites that the way to detect an EditItemTemplate was to use the above code: <code>if((e.Row.RowState &amp; DataControlRowState.Edit) &gt; 0)</code></p>
  
  <p>The Code in question:</p>
  
  <pre><code>protected void gvSchedule_RowEditing(object sender, GridViewEditEventArgs e)
      {
          string mySelect;
          gvSchedule.EditIndex = e.NewEditIndex;
          mySelect = (some SQL)
          scheduleDataSource.SelectCommand = mySelect;
          scheduleDataSource.DataBind();
      }
  
  protected void gvSchedule_RowDataBound(object sender, GridViewRowEventArgs e)
      {
          if (e.Row.RowType == DataControlRowType.DataRow)
          {
              if ((e.Row.RowState &amp; DataControlRowState.Edit) &gt; 0)
              {
                 //Altering Code
              }
          }
       }
  </code></pre>
  
  <p>And the gridView header:</p>
  
  <pre><code>&lt;asp:GridView ID="gvSchedule" runat="server" AlternatingRowStyle-CssClass="GridAlternatingRowStyle" EmptyDataText="There are no item(s) to display." 
              RowStyle-CssClass="GridRo wStyle" HeaderStyle-CssClass="GridHeaderStyle" AllowSorting="True" AutoGenerateColumns="False" 
              DataSourceID="scheduleDataSource" AutoGenerateEditButton="True" OnRowDataBound = "gvSchedule_RowDataBound" OnRowEditing="gvSchedule_RowEditing" &gt;
  </code></pre>
  
  <p>I'm sure there's something silly I'm overlooking, but I can't seem to find it.  I've tried all sorts of different logic statements to attempt to move past that if statement, but it simply won't go.  Let me know if you need any other information, I'll put it up.  Thanks!</p>