M
Mike Towle
Trying to dynamically create and bind (to a form) controls at runtime in the button_click event, not in Page_Init. If I create and bind the controls in Page_Init, they work fine. If I try doing this in the button_click event several things happen
1. The control.count property of the container that the control was added to (usually a form) does not change
2. I loose control of that control. I cannot clear the control or dispose of it on subsiquent calls to the webform. For instance if I dynamically create a dropdownlist control, I cannot get rid of it and I cannot clear the items list on the next call to the webform
How can I dynamically create and dispose controls in runtime that I can control on subsiquent calls to the webform? This application makes calls to a database and the control typs that are created depend upon what the values are in the database. One time I might use a textbox control because the value in the database is 'T' while another time I might use a dropdownlist if the value is 'D'.
1. The control.count property of the container that the control was added to (usually a form) does not change
2. I loose control of that control. I cannot clear the control or dispose of it on subsiquent calls to the webform. For instance if I dynamically create a dropdownlist control, I cannot get rid of it and I cannot clear the items list on the next call to the webform
How can I dynamically create and dispose controls in runtime that I can control on subsiquent calls to the webform? This application makes calls to a database and the control typs that are created depend upon what the values are in the database. One time I might use a textbox control because the value in the database is 'T' while another time I might use a dropdownlist if the value is 'D'.