Controls which are created dynamically must be recreated dynamically on
postback in order to exist.
One solution is to use the OnItemCreated even to create the controls:
http://openmymind.net/databinding/index.html#4.3
Another might be to use Denis Bauer's free dynamic control placeholder,
which might do the trick:
http://www.denisbauer.com/ASPNETCont...aceholder.aspx
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Amine" <Am***@discussions.microsoft.com> wrote in message
news:E3**********************************@microsof t.com...
Hello,
I am trying to create textbox control dynamically into a datagrid.
I do not know the number of columns until run time so I thought I could
use template columns dynamically and add them into the datagrid.
This works fine, but on post back all the data in the datagrid disappears.
Any idea why? I have the bad feeling that the view state has something to
do with it.
I do have viewstate enabled.
Note: I am implementing the Itemplate interface and I have Implemented the
InstantiateIn mehod.
Thanks!