title: Asp.net c# getting value from a textbox in a list view with data that is manually bound
body: <p>I'm trying to simply read a textbox in my listview. It's a shopping cart and I need to manually edit the cookie when the "new quantity" is typed in. I'm trying to use what I did for a dropdownbox, but I'm guessing because <strong>I manually bind the data instead of using a datasource</strong> is the difference preventing me access to the value in the textbox.   </p>
  
  <p>The weird thing is that it isn't getting null, it just isn't getting any value? I've added other things to the label so I know it's not how I'm calling label. All the results I find online are calling invalid things such as listview1.items[0].subitems[0], which are not members I can call. </p>
  
  <p>Any help is greatly appreciated</p>
  
  <p>Button Handler  </p>
  
  <pre><code> protected void editQ_Click(Object sender, CommandEventArgs e)
      {
  
          LinkButton lbSender = (LinkButton)sender;
          TextBox tb = (TextBox)lbSender.FindControl("tb1"); // this is the textbox
          productTableAdapter ad = new productTableAdapter();
          int idIn = int.Parse(e.CommandArgument.ToString());
          HttpCookie c = Request.Cookies["cart"];
          Label2.Text = tb.Text.ToString();
          // Label2.Text = tb.Text; doesn't work either.
          if (tb == null)
          {
              Label2.Text = "NULL ERROR";
          }
  
             ....
  
  
  
      }
  </code></pre>
  
  <p>Listview</p>
  
  <pre><code>&lt;asp:ListView ID="ListView1" runat="server" DataKeyNames="productNo" 
           &gt;
          &lt;AlternatingItemTemplate&gt;
              &lt;span style=""&gt;productNo:
              &lt;asp:Label ID="productNoLabel" runat="server" Text='&lt;%# Eval("productNo") %&gt;' /&gt;
              &lt;br /&gt;
              Name:
              &lt;asp:Label ID="productNameLabel" runat="server" Text='&lt;%# Eval("productName") %&gt;' /&gt;
              &lt;br /&gt;
              Quantity:
              &lt;asp:Label ID="productQuantityLabel" runat="server" Text='&lt;%# Eval("Quantity") %&gt;' /&gt;
  
             &lt;asp:TextBox id = "tb1" runat="server"&gt;&lt;/asp:TextBox&gt;
             &lt;asp:LinkButton id="editQ" runat="server" CommandArgument='&lt;%# Eval("productNo") %&gt;' onCommand ="editQ_Click"&gt;Change Quantity&lt;/asp:LinkButton&gt;
  
              &lt;br /&gt;
              price:
              &lt;asp:Label ID="priceLabel" runat="server" Text='&lt;%# Eval("price") %&gt;' /&gt;
  
              &lt;br /&gt;
              &lt;asp:Image ID = "img" runat="server" height = "150" ImageUrl='&lt;%# Eval("imgURL")%&gt;'&gt;&lt;/asp:Image&gt;
  
              &lt;br /&gt;
  &lt;br /&gt;&lt;/span&gt;
          &lt;/AlternatingItemTemplate&gt;
  </code></pre>