problem of using textbox session in c#
marc-antoine yonga
81
Reputation points
well, sirs,
I've got a problem of using textbox in aspx page which declared in c# page_load function page, using in click_button function. i've got the error message that the textbox tb_1 is not recognised.
the code is the following :
- aspx page :
<div>
<asp:button id="bt_3" runat="server" Text="push_variable_confirm" onclick="click_bt_3" />
<br />
<asp:table id="table_1" runat="server">
</asp:table>
<br />
<textarea id="tea_1" runat="server"></textarea>
</div>
- c# page :
public partial class WF_MS_jicixipi_testpro11 : System.Web.UI.Page
{
TableRow row = new TableRow();
//int i;
int NumeroTextBox;
protected void page_load (object sender, EventArgs e)
{
function11_load();
bt_3.Click += new EventHandler (click_bt_3);
}
protected void function11_load()
{
int[] numbers = { 0, 1, 2, 3, 4 };
foreach (int i in numbers)
{
NumeroTextBox = NumeroTextBox + 1;
TableCell cell = new TableCell();
TextBox tb_1 = new TextBox();
tb_1.ID = "tbok" + Convert.ToString(NumeroTextBox); cell.Controls.Add(tb_1);
row.Cells.Add(cell);
}
table_1.Rows.Add(row);
}
protected void click_bt_3 (object sender, EventArgs e)
{
tea_1.Value = tb_1.Text; //------ OR ------ tea_1.Value = tbok1.Text;
// théoriquement, :(, ça marche !!!!!!!!!!!!!!!!!!!!!!!!!!!!
}
}
thanks for resolving my problem.
marc-antoine.
Developer technologies | .NET | Other
Developer technologies | .NET | Other
Microsoft Technologies based on the .NET software framework
4,107 questions
Developer technologies | ASP.NET | Other
3,602 questions
Developer technologies | C#
11,584 questions
Sign in to answer