Datalist adding Dynamic controls

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
 
J

Jos

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).
 
P

Patrick

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top