protected void Page_Load(object sender, EventArgs e) { String arrName = "MyArray", arrValue = "\"1\", \"2\", \"text\""; ClientScriptManager cs = Page.ClientScript; cs.RegisterArrayDeclaration(arrName, arrValue); TextBox tmpTextBox; if ((tmpTextBox = PlaceHolderTextBox.FindControl(DynamicTextBoxSignature) as TextBox) != null) { LabelInfo.Text = "\"" + tmpTextBox.Text + "\" Page_Load IsPostBack=\"" + IsPostBack.ToString().ToLower() + "\""; } Button tmpButton = new Button(); tmpButton.ID = DynamicButtonSignature; tmpButton.Text = DynamicButtonSignature; tmpButton.Click += new EventHandler(DynamicButton_Click); PlaceHolderTextBox.Controls.Add(tmpButton); }
protected void ButtonSubmit_Click(object sender, EventArgs e) { TextBox tmpTextBox; if ((tmpTextBox = PlaceHolderTextBox.FindControl(DynamicTextBoxSignature) as TextBox) != null) { tmpTextBox.Text = "BBB"; } LabelInfo.Text += " ButtonSubmit_Click"; }