I have a gridview in a page and it have a template field:
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="txtReturn" runat="server" Text="0"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
And I wrote some code in a command button Click Event to read TextValue of this text box :
int i = 0;
foreach (GridViewRow row in grdFactor.Rows)
{
TextBox txt = (TextBox)(row.FindControl("txtReturn"));
int ret = 0;
try
{
ret = Int32.Parse(txt.Text);
if (ret > 0 && ret < factor.Orders[i].Entity)
{
factor.Orders[i].updateReturn(ret);
}
}
catch (Exception ex) { }
i++;
}
But the value of txt.Text is always Zero. Could you help me please? Thanks.