实现select标签取值和赋值的功能,有一个数据库 表news,三个字段(id,name,content),打开网页初次加载时,把name加载到select中(包括text,value),然后选择select中的option时,触发事件,把content的内容显示在一个<div>层里面,要求触发事件时,页面不刷新。看看那位大侠能帮一下忙!谢谢!

解决方案 »

  1.   

    查询所有Load事件绑定数据源DDL的selectIndexChanged事件中得到选中值。追加到层的innerHtml中去。。不想刷新加个updatepanel
      

  2.   


    dropdownlist联动
    <asp:ScriptManager ID="ScriptManager1" runat="server">
      </asp:ScriptManager>
      <div>
      <asp:UpdatePanel ID="UpdatePanel1" runat="server">
      <ContentTemplate>
      <asp:DropDownList ID="ddlLB" runat="server" Width="15%" AutoPostBack="True" OnSelectedIndexChanged="ddlLB_SelectedIndexChanged">
      </asp:DropDownList>
      <asp:DropDownList ID="ddlChild" runat="server" Width="20%">
      </asp:DropDownList>
      </ContentTemplate>
      </asp:UpdatePanel>
      </div>   
    protected void ddlLB_SelectedIndexChanged(object sender, EventArgs e)
      {
      if(this.ddlLB.SelectedValue!=null)
      {  }
      }