I have created some TextBox
controls dynamically in my Code Behind and need to retrieve the values in a new method, however I can not use% changed% in a new method.
try
{
DataTable tbDadosAux =// Método para obter dados;
DataTable tbDados = //filtra dados
qtd.Value = tbDados.Rows.Count.ToString();
table1.HorizontalAlign = HorizontalAlign.Center;
table1.CssClass = ("table table-bordered table-hover table-striped");
if (tbDados.Rows.Count !=0)
{
tabela1.Visible = true;
}
for (int i = 0; i < tbDados.Rows.Count; i++)
{
TableRow linha = new TableRow();
TableCell c1 = new TableCell();
TableCell c2 = new TableCell();
TableCell c3 = new TableCell();
Label lblPesNm = new Label();
TextBox txtSeqNum = new TextBox();
HiddenField hdPesCodComp = new HiddenField();
c1.Text = tbDados.Rows[i]["RETORNO"].ToString();
c1.HorizontalAlign = HorizontalAlign.Left;
txtSeqNum.ID = "txtSeqNum" + (i + 1);
txtSeqNum.Text = tbDados.Rows[i]["SEQUENCIAL"].ToString();
c2.Controls.Add(txtSeqNum);
c2.HorizontalAlign = HorizontalAlign.Left;
table1.HorizontalAlign = HorizontalAlign.Center;
table1.CssClass = ("table table-bordered table-hover table-striped");
linha.Cells.Add(c1);
linha.Cells.Add(c2);
table1.Rows.Add(linha);
}
}
catch (Exception ex)
{
if (tran.Connection != null)
{
tran.Rollback();
conn.Close();
// Erro.InnerHtml = "Ocorreu o seguinte erro: " + ex.Message;
}
}
finally
{
if (tran.Connection != null)
{
tran.Commit();
conn.Close();
}
}