How to retrive the dropdownlist1 items in textbox as 1,2,3,4 in VB.NEt [duplicate]
Possible Duplicate:
How to disable and uncheck the checkbox values from database fields..VB.NET
I have asp.net textbox1, 7 checkboxes and dropdownlist1 in my vb.net webform ....
In dropdownlist1 ... i have the following items ...as ,
1,2 3,5 6,7
i want when page loads then in textbox1 the text would be 1,2,3,4,5,6,7 according to the dropdownlist1
and checbox1, checkbox2, checkbox3, checkbox4, checkbox5, checkbox6, checkbox7 will be disabled.
This will set the value of the Text property of textbox1 to all of dropdownlist1's items' Text property (alternatively the Value could be used too). I'm not sure what you need with the checkboxes.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
For Each li As ListItem In dropdownlist1.Items
textbox1.Text += li.Text 'or li.Value
Next
End Sub
精彩评论