Dynamically Added TextBoxes

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default Dynamically Added TextBoxes

    Is there anyway to get the value of a dynamically added textbox that
    was added after OnInit in Page_Load on Postback?


    Page_Load

    Dim tb As New Textbox

    page.controls.add(tb)
    tb.text = "ASP.NET"
    End Sub


    But1_Click

    label1.text = tb.text


    End Sub


    My problem is tb.text is blank ("")

    Is there anyway to save the value between postback?

    Thanks
    KJ Guest

  2. Similar Questions and Discussions

    1. saving text values of dynamically created textboxes
      I have many textboxes that are created dynamically as child controls of my custom control. I know that I must recreate them after each postback...
    2. textboxes in dynamically loaded WUC not repopulated during PostBack
      i am building a webform that dynamically loads one of two web usercontrols during the webform's page_load event. i am using label, named TabId, on...
    3. Dynamically create non-fixed number of TextBoxes in Composite Control
      Hi, I have a composite control(TextBoxControl.cs) in my DynamicTextBox.aspx. On the Page_Load of the DynamicTextBox.aspx page, I am calling a...
    4. Why is my dynamically added TemplCol so slow?
      Hey. I'd appreciate if someone could improve the performance of my TemplateColumn. It runs nicely with one template, and very slow with another. ...
    5. Positioning Dynamically added controls
      Hi I am adding a textbox control at runtime that allows a user to enter a date. I also want to add a calendar icon beside the textbox so that the...
  3. #2

    Default Re: Dynamically Added TextBoxes

    Hi KJ,

    one way to do this is to save the value in the textbox into the viewstate.

    kishor.

    "KJ" <klj_mcsd@hotmail.com> wrote in message
    news:d83a9214.0312031032.163991a8@posting.google.c om...
    > Is there anyway to get the value of a dynamically added textbox that
    > was added after OnInit in Page_Load on Postback?
    >
    >
    > Page_Load
    >
    > Dim tb As New Textbox
    >
    > page.controls.add(tb)
    > tb.text = "ASP.NET"
    > End Sub
    >
    >
    > But1_Click
    >
    > label1.text = tb.text
    >
    >
    > End Sub
    >
    >
    > My problem is tb.text is blank ("")
    >
    > Is there anyway to save the value between postback?
    >
    > Thanks

    Kishor Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139