Trying to use value of dropdownlist to determine number of dynamic controls to create

Nov 6 2009 7:07 PM
I wish to allow the user to determine how many controls to generate based on their selection in the dropdownlist. My issue is that the value selected from the dropdownlist is available only after onselectedindexchanged is triggered. So I getting the value after the screen is rendered. Is there a way to obtain the selected value before onselectedindexchanged is triggered. The current code is generating the dynamic controls but only after I select a different item in the dropdownlist. Seems I need to get the dropdown value on the client side before postback. Any HELP would be greatly appreciated!!! Here is my code snippets: ASPX:  Number of Children controls?    0 1 2 3 4 5 6 7 8 9 10
 
ASPX.CS protected override void OnInit(EventArgs e) { base.OnInit(e); CreateChildControls(); } protected void DDL1_SelectedIndexChanged(object sender, EventArgs e) { myCount = DDL1.SelectedIndex; // myCount represents the # of rows of dynamic textboxes }

Answers (1)