Hi @marc-antoine yonga,
If your purpose is just to pass tb_1.Text and tb_2.Text to tea_1.
Then it is necessary to realize the dynamic creation of controls in page_load.
You can't do it with two buttons, they are actually two separate functions because of postback issues.
<div>
<asp:Button ID="bt_1" runat="server" Text="push_variable"/> <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>
TableRow row = new TableRow();
TableCell cell1 = new TableCell();
TableCell cell2 = new TableCell();
TextBox tb_1 = new TextBox();
TextBox tb_2 = new TextBox();
//Button bt_2 = new Button();
int IntChamps;
protected void page_load(object sender, EventArgs e)
{
tea_1.Visible= false;
bt_3.Click += new EventHandler(click_bt_3);
IntChamps = 1;
if (IntChamps == 1)
{
cell1.Controls.Add(tb_1);
cell2.Controls.Add(tb_2);
row.Controls.Add(cell1);
row.Controls.Add(cell2);
}
table_1.Controls.Add(row);
}
protected void click_bt_3(object sender, EventArgs e)
{
table_1.Controls.Remove(row);
tea_1.Visible = true;
tea_1.Value = tb_1.Text + " // " + tb_2.Text; // théoriquement, :(, ça marche !!!!!!!!!!!!!!!!!!!!!!!!!!!!
}
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.