I have the following requirement for my asp.net page:
The user can add a dynamic text box on page A by clicking the "Add a new category" hyperlink
He presses the submit button on page A and redirects to page B.
When he clicks the link on the Link page on this page, the text fields that he added should be saved.
Can someone help me with the code on this?
Appreciate your help!
In the ButtonClick method write.
TextBox tb = new TextBox(); Parent.Controls.Add( tb );
A parent is a control to which you want to add a text field, such as a panel.
.
, .
. , , , " ", .
:
, ,
"1" "", .. ,
. ""... btnadd_click,
protected void btnadd_Click ( , EventArgs e) {
int i; for (i = 0; i < Convert.ToInt32(txtno.Text); i++) { TextBox txtbox = new TextBox(); phtxt.Controls.Add(txtbox); phtxt.Controls.Add(new LiteralControl("<br>")); } }
... ,
, , , , . , . , , -. , , , , .
. Onload, , . viewstate. viewstate, . .
as a rule, I follow when you create a dynamic user control, then you must set its identifier so that ASP.net can redistribute it on the back side and save the values of the controls after sending back, you must reload the user controls the Page_Init event.
hope this helps.
Source: https://habr.com/ru/post/1706236/More articles:Доступна ли виртуализация WrapPanel для WPF? Коммерческие или бесплатные - wpf"Неверный вызов или аргумент процедуры" при установке объекта "Принтер" - vb6break the word in php letters - phpHow to convert function return value from array reference? - arraysWhere can I see a list of links and web links in an ASP.NET 2.0 web project - .netSQL Server 2005: replication, varbinary - sql-server-2005What is a failure condition in the CLR exception system? - .netiPhone SDK - NSStreamEventHasBytesAvailable / appendBytes: Crash - iphonePlease help with my JSP internationalization issue - java.hgignore for CakePHP application? - phpAll Articles