How to generate asp.net textbox accoring to the digit displays in label text?
If in the label the default text is 10 then ten textbox controls will be generated in webform 开发者_如何学Python...
Can anybody did this in VB.NET ?
Look at add control. You simply use a loop based on the counter in the label then you say myWebForm.Controls.Add(txtBox); where txtBox is:
Dim txtBox as TextBox
Sure here is some code:
Dim count as Integer
count = CType(Me.myLabel.Text, Integer)
For i as Integer=0 to count-1
txtBox = new TextBox()
txtBox.ID = "txt" & i.ToString()
myForm.Controls.Add(txtBox)
Next i
精彩评论