List Info

Thread: Re: Dynamic text boxes not seen in code behind




Re: Dynamic text boxes not seen in code behind
user name
2008-03-12 16:33:52
When I submit the page and fire the subroutine that handles
the dynamic
controls I can't seem to get the page to see them.  I tried
this: 
Dim controlscount As Integer = PlaceHolder1.Controls.Count
            lblInfo.Text = String.Format("The number of
controls in
PlaceHolder1 = ", controlscount)

I keep getting "0" as a value.  It's not seeing
any controls, yet they
are showing up on the page correctly.  So I know they are
there.  Can
anyone see why I'm not finding them?  I'm assuming I've
overlooked
something simple.

This is how I'm generating my textbox's based on which
checkbox was
checked:
Protected Sub btnContinue_Click(ByVal sender As Object,
ByVal e As
System.EventArgs) Handles btnContinue.Click
        
        For Each size As ListItem In CheckBoxList1.Items
            If size.Selected = True Then
                Dim label1 As New Label
                label1.ID = "lbl" &
size.Value
                label1.Text = size.Text & ":
"
                label1.CssClass = "lblPrice"
                Dim textbox1 As New TextBox
                textbox1.ID = size.Value
                textbox1.Text = Me.txtPrice.Text
                textbox1.Columns = "6"
                Dim LControl As New LiteralControl
                LControl.Text = "<br /><br
/>"
                PlaceHolder1.Controls.Add(label1)
                PlaceHolder1.Controls.Add(textbox1)
                PlaceHolder1.Controls.Add(LControl)
            End If
        Next
    End Sub

And this is the control on the manager.aspx page where they
are built:
	<asp:Panel ID="pnlSizePrices"
runat="server">
        Price per size(optional):<br /><br />
        <asp:PlaceHolder ID="PlaceHolder1"
runat="server"></asp:PlaceHolder>       

    	</asp:Panel>


Russ


--- List Settings ---
http://aspadvice.com/list
s/


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )