S
Scott Schluer
Hello,
I've got myself a small problem and I'm hoping someone can help.
I have a DataList called dlProducts (displays products from a database).
Within the <ItemTemplate> container of the DataList, I have a PlaceHolder
control called phVariations. During the ItemDataBound event for dlProducts,
I dynamically create a few DropDownLists (again, from a database) and .Add
the DropDownList to the PlaceHolder control. That all works just fine, my
drop downs show up, populated with data, everything looks good.
My problem comes from trying to access this data after postback. The
datalist is only bound when Page.IsPostBack = False and the dynamic controls
are created in the ItemDataBound event. I understand that viewstate only
captures the state of my dynamic controls and not the controls themselves. I
also know I have to recreate my controls during Page_Init or Page_Load and
they will then be repopulated by viewstate.
My question is that since the controls were created during ItemDataBound,
how am I going to recreate them for each Item in the DataList on postback
since the datalist is not bound then? I've been running into a brick wall
with this for a few hours now. Time to turn to others for assistance!
Thanks for anything you can contribute.
Scott
I've got myself a small problem and I'm hoping someone can help.
I have a DataList called dlProducts (displays products from a database).
Within the <ItemTemplate> container of the DataList, I have a PlaceHolder
control called phVariations. During the ItemDataBound event for dlProducts,
I dynamically create a few DropDownLists (again, from a database) and .Add
the DropDownList to the PlaceHolder control. That all works just fine, my
drop downs show up, populated with data, everything looks good.
My problem comes from trying to access this data after postback. The
datalist is only bound when Page.IsPostBack = False and the dynamic controls
are created in the ItemDataBound event. I understand that viewstate only
captures the state of my dynamic controls and not the controls themselves. I
also know I have to recreate my controls during Page_Init or Page_Load and
they will then be repopulated by viewstate.
My question is that since the controls were created during ItemDataBound,
how am I going to recreate them for each Item in the DataList on postback
since the datalist is not bound then? I've been running into a brick wall
with this for a few hours now. Time to turn to others for assistance!
Thanks for anything you can contribute.
Scott