asp.net cannot retrieve value of textbox inside placeholder inside repeater
Posted on 2011-09-07
I am using a repeater to generate a dynamic quiz. Each line in the repeater is represented by a custom user control named question. Each question has a placeholder (ID=placeHolderInput) for the input field which writes the input field based on question type (i.e., question type 5 = textbox this is the example below).
Dim tb As New TextBox
tb.ID = "txtBoxInput"
The quiz displays fine and I can grab the data easily from the controls outside the placeholder, but the newly entered user input data inside the placeholder is eluding me. When the user clicks submit, I loop through the repeater to grab values,
Dim eR As Repeater = myRepeater
For Each r As RepeaterItem In eR.Items
Dim eqitem As controls_question = r.FindControl("question")
Dim ph As PlaceHolder = eqitem.FindControl("placeHolderInput")
Dim tBO as Textbox = ph.FindControl("txtBoxInput") -- this returns no value
Dim tBOx as TextBox = eqitem.FindControl("txtBoxInput") -- this also returns no value
Since the textbox has no value, I cannot grab the text within it. I loop through repeaters all the time to assess values, but I have never added in the placeholder and this seems to be the issue.