ASP.Net笔记之与Dropdownlist联动的Image控件

    Private Sub Page_Load(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles MyBase.Load
        
'在此处放置初始化页的用户代码
        If Not Page.IsPostBack Then
            
Dim a As New ListItem("asp""images/Title-MC2222.gif")
            
'用listitem 对象的实例时可以指定标签与选定值属性
            Dim b As New ListItem("php""images/Title-MC3026.gif")
            DropDownList1.Items.Add(a)
            DropDownList1.Items.Add(b)
            Image1.Visible 
= False
        
End If
    
End Sub


    
Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
        Image1.Visible 
= True
        Image1.ImageUrl 
= DropDownList1.SelectedItem.Value
    
End Sub

为Dropdownlist控件增添选项有若干种方法,我最喜欢这种和Arraylist绑定的方法
posted on 2005-02-01 17:30  雪无止境  阅读(420)  评论(0编辑  收藏  举报