title: GridView onDataBinding
body: <p>i have a gridview that uses template where in that template i have two buttons:
  here is my code:</p>
  
  <pre><code>   &lt;asp:GridView ID="gvtransaction" runat="server" AutoGenerateColumns="False" Width="60%" OnDataBinding="gvtransaction_DataBinding"&gt;
              &lt;Columns&gt;
                  &lt;asp:TemplateField HeaderText=""&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:Label ID="lblid" runat="server" Text='&lt;%# Bind("id") %&gt;' Visible="false"&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
                  &lt;asp:TemplateField HeaderText="Consumer"&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:Label ID="lblfirstname" runat="server" Text='&lt;%# Bind("FirstName") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
                  &lt;asp:TemplateField HeaderText="Name"&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:Label ID="lbllastname" runat="server" Text='&lt;%# Bind("LastName") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
                  &lt;asp:TemplateField HeaderText="Amount"&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:Label ID="lblamount" runat="server" Text='&lt;%# Bind("Amount") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
                  &lt;asp:TemplateField HeaderText=""&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:Label ID="lblcurrencyID" runat="server" Text='&lt;%# Bind("CurrencyID") %&gt;' Visible="false"&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
                  &lt;asp:TemplateField HeaderText="Account Name"&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:Label ID="lblcurrencyname" runat="server" Text='&lt;%# Bind("CurrencyName") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
                  &lt;asp:TemplateField HeaderText="Status"&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:Label ID="lblstatus" runat="server" Text='&lt;%# Bind("Status") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
                  &lt;asp:TemplateField HeaderText="DateCreated"&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:Label ID="lbldatecreated" runat="server" Text='&lt;%# Bind("DateCreated") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
  
                  &lt;asp:TemplateField HeaderText=""&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:Button ID="btnApprove" runat="server" Text="Approve" CommandName="Select" OnClick="btnApprove_Click" /&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
                  &lt;asp:TemplateField HeaderText=""&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:Button ID="btnReject" runat="server" Text="Reject" CommandName="Select" OnClick="btnReject_Click" /&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
              &lt;/Columns&gt;
          &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>what i want to happen is, when the page loads and it sees that the status is not Pending, the buttons should not be visible otherwise the buttons are visible.</p>
  
  <p>help anyone.?</p>