473,320 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Updating placeholder during runtime

Hi Everyone, here is the problem I am having with placeholder:

I have a repeater and within that repeater, I have an item template. Now this template is formatted with a couple of tables, but for this question I have removed them to make things easier to read:

Expand|Select|Wrap|Line Numbers
  1. <asp:Repeater ID="Repeater1" OnItemDataBound="R1_ItemDataBound" runat="server">
  2.  
  3.    <ItemTemplate>
  4.       <asp:PlaceHolder ID="phAnswers" runat="server"></asp:PlaceHolder>               
  5.    </ItemTemplate>
  6. </asp:Repeater>
  7.  
  8.  
Then, on the event OnItemDataBound, I create a new placeholder, bind it to the existing on (phAnswers), however the placeholder is not updated with the radiobuttons/textboxs that are created:

Expand|Select|Wrap|Line Numbers
  1.  
  2.         Dim rdList As New RadioButtonList
  3.         Dim newRadio As New RadioButton
  4.  
  5.  If (e.Item.ItemType = ListItemType.Item) Or _
  6.             (e.Item.ItemType = ListItemType.AlternatingItem) Then
  7.  
  8.             Dim tempPH As PlaceHolder
  9.  
  10.             tempPH = e.Item.FindControl("phAnswers")
  11.  
  12.             For x As Integer = 0 To (t_MC.Count - 1)
  13.  
  14.                     newRadio = New RadioButton
  15.  
  16.                     newRadio.ID = "Answer" + x.ToString
  17.                     newRadio.Text = t_MC(x).Value
  18.                     rdList.Controls.Add(newRadio)
  19.  
  20.                 Next
  21.  
  22.      tempPH.Controls.Add(rdList)
  23.  
Any ideas why phAnswers is not updated with the new tempPH placeholder?
Cheers
Mar 11 '10 #1
1 2080
Frinavale
9,735 Expert Mod 8TB
Have you tried using a Panel instead of a Placeholder?

I don't think this is going to work out for you too well because of the way you are using/declaring your dynamic controls.

Check out this quick overview of how to use dynamic controls in asp.net

-Frinny
Mar 11 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Hai Nguyen | last post by:
Hi all I'm trying ing to create usercontrols dynamically and add them into a placeholder. During a postback i got the following error " Failed to load viewstate. The control tree into which...
2
by: theo | last post by:
Hi... I wish to extract the text content of an Xml file and assign it to DropDownList controls at runtime.I can get the Xml file text content into the DropDownList controls (Ex...if 5 Xml text...
4
by: theo | last post by:
Program flow...load file,then extract the xml text tags from the file,then the number of Xml tags retrieved from the file determines the number of dropdownlist controls instanciated in the...
4
by: blue | last post by:
I have a drop-down list, a radio button list and a submit button. I'm adding these controls to a table and I'm adding the table to a Placeholder. I'm adding it to the Placeholder because I don't...
2
by: bdwise | last post by:
What is the difference between a Panel and a <div> tag with runat="server"? It seems that I can add child controls to either one in a code-behind and they both render to a <div> anyway at runtime....
2
by: Chad Crowder | last post by:
Is it possible to create a placeholder inside a template column of a datagrid? My goal is to use a placeholder, and during runtime add user controls to the placeholder as the items in the datagrid...
2
by: Mark | last post by:
I'm adding several controls (labels, etc.) to a placeholder programatically. I'd like the PlaceHolder to maintain these contents during postbacks without having to programmatically recreate their...
1
by: Simon Wallis | last post by:
Hi, I have a PlaceHolder on a place, to which I add a DropDownList (using myPlaceHolder.Controls.Add(ddl). The user selects something from the DropDownList and posts the page. Now I try to get...
10
by: sqlboy2000 | last post by:
Hello all, I have something very simple going on here and I'm scratching my head as to what the problem is. There are 4 items in my project, 2 webforms, a user control, and a module: ...
0
by: seigo | last post by:
Hello, I faced with the following problem. I have a PlaceHolder on a page and a few UserControls which have custom events, for instance: public delegate void SelectHandler(object sender,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.