I have a grid view that the user can expand to fill a form. When I want to get the value of the textbox it is empty. Here is what it look like I added a red arrow to show you the information I would like to get on button presss

Here Is my front end
<asp:TemplateField>
<ItemTemplate>
<tr>
<td colspan="100%" style="background:#F5F5F5" >
<div id="div<%# Eval("componente_id") %>" style="overflow:auto; display:none; position: relative; left: 15px; overflow: auto">
<div class="ExpandTableHeader">
Cambiar la cantidad
</div>
<div class="body">
<label for="validationOfTypeID">Armario:</label>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:DropDownList ID="drCloset" AppendDataBoundItems="True" runat="server" Width="20%" Height="30px" AutoPostBack="true" OnSelectedIndexChanged = "OnClosetIndexChanged"></asp:DropDownList>
<br/>
<label for="validationOfTypeID" visible="false" >cajon</label> <br/>
<asp:DropDownList ID = "drDrawer" AutoPostBack="true" runat="server" Width="20%" Height="30px" >
</asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostbackTrigger ControlID="drCloset" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
<asp:Label ID="lblQuantity" runat="server" Text=""></asp:Label>
<label for="validationOfTypeID"></label>
<asp:DropDownList Height="30px" ID="drOperation" runat="server" AutoPostBack="true">
<asp:ListItem>+</asp:ListItem>
<asp:ListItem>-</asp:ListItem>
</asp:DropDownList>
<asp:TextBox width="50px" ID="txtChangeQuantity" runat="server" TextMode="Number" min="0" step="1" Value="0" ></asp:TextBox>
<asp:Label ID="lblTotal" runat="server" Text=""></asp:Label>
<br/>
</br>
<asp:Button ID="btnConfirmPurchases" runat="server" Text="Validar" AutoPostback="true" OnClick="confirm_purchases_Click" />
<asp:Button ID="btnHide2" runat="server" Text="Anular" AutoPostBack="True" />
</div>
<asp:DetailsView id="DetailsView1" DataKeyNames="componente_id" Runat="server" Width="300px" Font-Names="Calibri"/>
</td>
</tr>
</ItemTemplate>
</asp:TemplateField>
When the user presses the button btnConfirmPurchases and I use the debugger I found out txtChangeQuantity.Text is empty
private static TextBox txtChangeQuantity;
protected void gvInventatario_OnRowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
txtChangeQuantity = (TextBox)e.Row.FindControl("txtChangeQuantity");
}
}
protected void confirm_purchases_Click(object sender, EventArgs e)
{
int resultingQuantity = 0;
if (drOperation.Text == "-")
{
resultingQuantity = quantity - int.Parse(txtChangeQuantity.Text);
}
else
{
resultingQuantity = quantity + int.Parse(txtChangeQuantity.Text);
}
if (resultingQuantity > 0)
{
}
}
And here is my Page load as some of you have asked
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ViewState["sortOrder"] = "";
PopulateSorting("", "");
PopulateGridview(queryStrPopulateBasic);
gvInventario.DataSource = dt;
gvInventario.DataBind();
}
}
txtChangeQuantity.Text is empty even when the user writes something inside the textbox.
UPDATE
When I tried to add a repeater inside my code the textbox was no longer visible here is the new aspx code.
<asp:TemplateField>
<ItemTemplate>
<tr>
<td colspan="100%" style="background:#F5F5F5" >
<div id="div<%# Eval("componente_id") %>" style="overflow:auto; display:none; position: relative; left: 15px; overflow: auto">
<div class="ExpandTableHeader">
Cambiar la cantidad
</div>
<div class="body">
<label for="validationOfTypeID">Armario:</label>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:DropDownList ID="drCloset" AppendDataBoundItems="True" runat="server" Width="20%" Height="30px" AutoPostBack="true" OnSelectedIndexChanged = "OnClosetIndexChanged"></asp:DropDownList>
<br/>
<label for="validationOfTypeID" visible="false" >cajon</label> <br/> <%--WARGING DO NOT CHANGE NAME cajon WILL BREAK APPLICATION --%>
<asp:DropDownList ID = "drDrawer" AutoPostBack="true" runat="server" Width="20%" Height="30px" >
</asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostbackTrigger ControlID="drCloset" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
<asp:Repeater id="Repeater1" OnItemCommand="Repeater1_ItemCommand" runat="server">
<ItemTemplate>
<asp:Label ID="lblQuantity" runat="server" Text=""></asp:Label>
<label for="validationOfTypeID"></label>
<asp:DropDownList Height="30px" ID="drOperation" runat="server" AutoPostBack="true">
<asp:ListItem>+</asp:ListItem>
<asp:ListItem>-</asp:ListItem>
</asp:DropDownList>
<asp:TextBox width="50px" ID="txtChangeQuantity" runat="server" TextMode="Number" min="0" step="1" Value="0" ></asp:TextBox>
<asp:Label ID="lblTotal" runat="server" Text=""></asp:Label>
<br/>
</br>
<asp:Button ID="btnConfirmPurchases" runat="server" Text="Validar" AutoPostback="true" OnClick="confirm_purchases_Click" />
<asp:Button ID="btnHide2" runat="server" Text="Anular" AutoPostBack="True" />
</ItemTemplate>
</asp:Repeater>
</div>
<asp:DetailsView id="DetailsView1" DataKeyNames="componente_id" Runat="server" Width="300px" Font-Names="Calibri"/>
</td>
</tr>
</ItemTemplate>
</asp:TemplateField>

txtChangeQuantitywhy this is declared as static? Can you show how it is declared in the aspx page? Because is to declared in the code behind only and not in the aspx page, it will not maitain its state. That's why you will not get its value when you submit the form.txtChangeQuantityand why are you assigning value to it in RowDataBound event?