ahmed
ahmed

Reputation: 79

I want to create text boxes and the number is different every time in vb

I am working with webpage and I will connect the data i have to data base. so my question how can I create different number of textboxes and assing values or data to them and not loss them? I working on a web page and i have placeholders for the new textboxes but i have no idea how to keep them there and assign value to them in order to save them in the database

Upvotes: 0

Views: 278

Answers (2)

Ahmed
Ahmed

Reputation: 135

Dim c As Integer = 0
While c < 10
    Dim lab As New Label()
    Dim ltr As New Literal()
    lab.Text = c.ToString()
    ltr.Text = "<br/>"
    PlaceHolder1.Controls.Add(lab)
    PlaceHolder1.Controls.Add(ltr)
    C+=1

End While

and if you are working with a databese, you can always use the data grid because data grid is dynamic. later on you can remove the borders to make it as label or text box it is up to u.

Upvotes: 1

Jani Hyyti&#228;inen
Jani Hyyti&#228;inen

Reputation: 5407

You tagged the question with asp-classic but talk about textboxes and placeholders so I assume you are using ASP.NET Web Forms.

It's hard to say what your situation is without example code but would this be helpful?

http://webdevel.blogspot.fi/2009/05/get-textbox-values-from-repeater-easy.html

Upvotes: 0

Related Questions