Q
Quentin Huo
Hi:
There can be only one <form> control in one page. So generally the user
controls should not include the <form> control.
I created a user control which is used to edit the book's information and I
need to dynamically create the TextBox controls for the author names of a
book because different books have different numbers of the authors ( who
knows how many authors a book has.). I created a TextBox for an author
firstly:
TextBox tb = new TextBox();
tb.ID="authorname";
.......
And I added it to a <asp:Label> control to show it up:
authorsDiv.Controls.Add(tb);
And then I added it to the form control , as
formID.Controls.Add(tb);
Now the problem happened because the form is in the parent of the user
control. So how can I add the dynamically-created TextBox to the <form>
control which is in the user control's parent?
Thanks
Q.
There can be only one <form> control in one page. So generally the user
controls should not include the <form> control.
I created a user control which is used to edit the book's information and I
need to dynamically create the TextBox controls for the author names of a
book because different books have different numbers of the authors ( who
knows how many authors a book has.). I created a TextBox for an author
firstly:
TextBox tb = new TextBox();
tb.ID="authorname";
.......
And I added it to a <asp:Label> control to show it up:
authorsDiv.Controls.Add(tb);
And then I added it to the form control , as
formID.Controls.Add(tb);
Now the problem happened because the form is in the parent of the user
control. So how can I add the dynamically-created TextBox to the <form>
control which is in the user control's parent?
Thanks
Q.