![]() |
| ||
| Dynamically Adding User Controls at Runtime Im trying to dynamically add controls such as text boxes, radio buttons, check boxes, etc to a user control(ascx page). Im basically trying to build a very simple faceted search. Here is the scenario the user defines a string that specifies what is to appear on the page, some thing like this: searchParams = "Name:TextBox, City:Radio{a;b;c}" So the Name field will be a text box, and the City field will be a group of the three radio buttons "a,b,c". Im generating the user controls in a select case statement as follows: Select Case source(1) But im getting this error: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). when executing this line: Me.Controls.Add(radio) So I researched this and I read places that I should try and add things to a placeholder instead of the page itself, I tried that but that didnt work. I also tryed using binding syntax <%#blah%> instead of <%%> and that didnt work either. Im running out of ideas and I dont know what the problem is? I need to be able to dynamically generate controls onto the page according to that user defined string. Any ideas? |
| All times are GMT -4. The time now is 2:09 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC