title: How to toggle a gridview templated asp button text using jquery or javascript
body: <p>I have a gridview where one column is an "Add" / "Remove" asp:button which I would like to toggle the text when clicked with either jquery or javascript.  I have not been able to locate a good example for this.</p>
  
  <p>Here is my markup for the template field:</p>
  
  <pre><code>&lt;asp:TemplateField HeaderText="ADD &lt;br /&gt; REMOVE" HeaderStyle-ForeColor="White" &gt; 
      &lt;ItemTemplate &gt;
         &lt;asp:Button id="btnBuy" runat="server" Width="50px" Height="15px" BorderStyle="Solid" Text="ADD" Font-Size="7pt"                                  BackColor="#FFFF80" /&gt;
      &lt;/ItemTemplate&gt;
      &lt;HeaderStyle Width="7%" /&gt;
      &lt;ItemStyle CssClass="sessionItems" VerticalAlign="Middle"  HorizontalAlign="Center" /&gt;
  &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>Here is some jquery but it doesn't work as I expect this is more for a single button:</p>
  
  <pre><code>           $('#btnBuy').click(function()
            {  
              if ($(this).text() == "ADD")
              {
                  $(this).text("REMOVE");
              } else {
                  $(this).text("ADD");
              }
          })
  </code></pre>
  
  <p>Please advise how to correctly toggle the gridview button text?</p>
  
  <p>Thank you,
  Jim </p>
  
  <p>Here is my checkbox and it does not post back:</p>
  
  <pre><code>&lt;asp:TemplateField HeaderText="Select &lt;br /&gt; Files" HeaderStyle-ForeColor="White" &gt; 
                          &lt;ItemTemplate &gt;
                              &lt;asp:CheckBox ID="chkSelectVideo" runat="server" OnClick="checkboxClicked(this)" ToolTip="Select file for download" 
                                  Enabled='&lt;%# Eval("SORD_EnableSelectionCheckBox") %&gt;' Checked='&lt;%# Eval("SORD_SelectedForDownloadFlag") %&gt;' /&gt;
                          &lt;/ItemTemplate&gt;
                          &lt;HeaderStyle Width="6%" /&gt;
                          &lt;ItemStyle VerticalAlign="Middle" HorizontalAlign="Center" /&gt;
                      &lt;/asp:TemplateField&gt;
  </code></pre>