<asp:DropDownList ID="num" Runat="server" OnSelectedIndexChanged="num2">
<asp:ListItem Value="01.gif" Selected="True">01</asp:ListItem>
<asp:ListItem Value="02.gif">02</asp:ListItem>
<asp:ListItem Value="03.gif">03</asp:ListItem>
<asp:ListItem Value="04.gif">04</asp:ListItem>
<asp:ListItem Value="05.gif">05</asp:ListItem>
<asp:ListItem Value="06.gif">06</asp:ListItem>
<asp:ListItem Value="07.gif">07</asp:ListItem>
</asp:DropDownList>
NUM改变时怎样才能当在<asp:Image id="Image1" ImageUrl="" Width="64px"></asp:Image>中显示图片

解决方案 »

  1.   

    首先注意这一行要是这样:
    <asp:DropDownList ID="num" Runat="server" OnSelectedIndexChanged="num2" AutoPostBack="True">
    <asp:Image id="Image1" ImageUrl="" Width="64px" Runat="server"></asp:Image>
    (Runat="server"属性不能丢)然后在后台写:
    private void num2(object sender, System.EventArgs e)
    {
         Image1.ImageUrl=num.SelectedItem.Value;
    }
      

  2.   

    1.设置DropDownList_1的Autopostback=true;
    2.在DropDownList_1_SelectedIndexChanged中写
    Image1.ImageUrl=DropDownList_ServerName.SelectedItem.Value
      

  3.   

    应该是这样,有个地方忘了改
    1.设置DropDownList_1的Autopostback=true;
    2.在DropDownList_1_SelectedIndexChanged中写
    Image1.ImageUrl=DropDownList_1.SelectedItem.Value