DropDownList2.Attributes.Add("onchange", "changearea1()");
        DataSet ds = sjAspDBMgr.OpenSQLDataSetEx("PageInfo", "SJXQWebSitePageInfo.dbo.Get_DLL", "DLL");
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            DropDownList2.Items.Add(new ListItem(ds.Tables[0].Rows[i][1].ToString(),ds.Tables[0].Rows[i][2].ToString()));
        }
        Label1.Text = DropDownList2.Items[DropDownList2.SelectedIndex].Value;
        DataSet datads = sjAspDBMgr.OpenSQLDataSetEx("PageInfo", "SJXQWebSitePageInfo.dbo.Get_DLL", "System");
        for (int i = 0; i < datads.Tables[0].Rows.Count; i++)
        {
            DropDownList1.Items.Add(new ListItem(datads.Tables[0].Rows[i][1].ToString(),datads.Tables[0].Rows[i][1].ToString()));
        }<body>
    <form id="form1" runat="server">
        <uc1:PageHeader ID="PageHeader1" runat="server" />
    <div>
    
       <table align="center" border="1" cellpadding="0" cellspacing="0" style="border-collapse:collapse" width="80%">
            <tr>
                <td  class="H_Tr_L" colspan="3">
                    請新增這個系統會用到的dll</td>
            </tr>
            <tr>
                <td  class="H_Tr_L">
                    System</td>
                <td colspan="2">
                    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
                    </asp:DropDownList>
                    <asp:Button ID="btnShan" runat="server" CommandName="delete" CssClass="btn"  Text="刪除" 
                        onclick="btnShan_Click" />
                    <br />
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                    <asp:Button ID="btnZeng" runat="server" Text="新增"  CssClass="btn"  
                        onclick="btnZeng_Click" />
                        </td>
            </tr>
            <tr>
                <td class="H_Tr_L" rowspan="2">
                    User Defined</td>
                <td colspan="2">
                    <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True">
                    </asp:DropDownList>
                    &nbsp;
                    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                    &nbsp;
                    <asp:Button ID="btnDelete" runat="server" CommandName="delete" CssClass="btn" Text="刪除" 
                        onclick="btnDelete_Click" />
                        </td>
            </tr>
            <tr>
                <td>DLLName
                    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                        </td>
                <td>
                    DLLPath
                    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                    <asp:Button ID="btnAdd" runat="server" CommandName="delete" CssClass="btn"  Text="新增" 
                        onclick="btnAdd_Click" />
                        </td>
            </tr>
            </table>
    </div>
    </form>
</body>
</html>

解决方案 »

  1.   

    Sorry,没有看清楚  DropDownList2.Attributes.Add("onchange", "changearea1()"); 放在Page_Load
    看看呢,再不行,在Javascript设置断点,调试吧 
      

  2.   

    <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True" OnSelectedIndexChanged="MySelectedIndexChanged"> 
                        </asp:DropDownList> 
     
    protected void MySelectedIndexChanged(object sender, EventArgs e)
    {
    // ........
    }
      

  3.   


    可能是你js函数问题吧var index = document.getIlemntById("myDrop").selectedIndex;
      

  4.   

    DropDownList2.Attributes.Add("onchange", "changearea1()"); 
    这个是我后来用加的  用来替补的方案
    我复制的时候不小心放上去了    
      

  5.   

    DropDownList2.Attributes.Add("onchange", "changearea1()"); 是多余的   是我另外写的一个替补方案
         这句话是没有的    各位大侠再看看
      

  6.   

    感觉应该没有问题。
    http://blog.csdn.net/greatverve/archive/2008/12/01/3418348.aspx
    你查看一下源代码,看看究竟生成了什么东西。
      

  7.   

    re
    lz检查下控件的autopostback是不是设置对了
      

  8.   

    AutoPostback=true;  我上面不是已经设置了吗?