sureshcd10 Posted May 4, 2004 Posted May 4, 2004 How can I dynamically add controls to a web form.Also how can I dynamically control the position(Formatting) on the form with which a control is to be displayed?( Plz provide sample code). Thanks in advance :confused: :confused: :o Quote ima
evaleah Posted May 4, 2004 Posted May 4, 2004 I have several pages that controls appear to be created at runtime but they are not. I just set the controls to visible=false until they are needed. Then at runtime it is easy to set visible=true again and vice versa. .Net doesn't actually send the HTML code for the control to the browser if it is marked as visible=false so it automatically controls the layout. I like it doing it for me:-) HTH Eva Quote
takesoln Posted May 7, 2004 Posted May 7, 2004 Use a Place holder hi ... Use the placeholder control for alignment and create your dynamic controls within the place holder. If you are using the controls to postback data, then don't create them outside the page_load method. If you want to do the control creation, you have to do it before the page framework's SaveviewState method is invoked. you can override this method using the onPrerender method. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.