Datalist adding Dynamic controls

  • Thread starter Thread starter Patrick
  • Start date Start date
P

Patrick

Hello

I have a Datalist, that I fill with the PopulateList() method. This method
selects all Items from Database and binds the Dataset to the DataLilst. Now,
when clicking Edit, in the Editcommand I add some dynamic TextBoxes to a
PlaceHolder in the EditItemTemplate.

So fare, all fine - now, when I select Update, in the UpdateCommand-Event I
want to get the Value of these added TextBoxes. My Problem is now, when I
just search for the PlaceHolder and check all controls inside, it is empty.
So I run the PopulatePlaceHolder method also in the UpdateCommand and i find
the controls, but they don't have any values inside.

Can someone help me

Thanks
Patrick
 
Patrick said:
Hello

I have a Datalist, that I fill with the PopulateList() method. This method
selects all Items from Database and binds the Dataset to the DataLilst. Now,
when clicking Edit, in the Editcommand I add some dynamic TextBoxes to a
PlaceHolder in the EditItemTemplate.

So fare, all fine - now, when I select Update, in the UpdateCommand-Event I
want to get the Value of these added TextBoxes. My Problem is now, when I
just search for the PlaceHolder and check all controls inside, it is empty.
So I run the PopulatePlaceHolder method also in the UpdateCommand and i find
the controls, but they don't have any values inside.

You need to run the PopulatePlaceHolder method in Page_Init instead,
so that the controls are already in place when they are filled with their
viewstate information (this happens after Page_Init and before Page_Load).
 
Hi Jos
You need to run the PopulatePlaceHolder method in Page_Init instead,
so that the controls are already in place when they are filled with their
viewstate information (this happens after Page_Init and before Page_Load).

Thanks for your answer. This is a good Idea, but the problem is, I add this
TextBoxes to the EditItemTemplate, so on the PageInit there is nothing in
Edit, so it won't add anything. And afterwards, when I edit something, that
code won't be executed.

any other good ideas?
Thnx
 
Back
Top