开发者

How to retrive the dropdownlist1 items in textbox as 1,2,3,4 in VB.NEt [duplicate]

This question already has an answer here: 开发者_开发百科 Closed 10 years ago.

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜