日期:2014-05-17  浏览次数:20518 次

Dropdownlist的OnSelectedIndexChanged死活不触发
本帖最后由 vanchris 于 2012-12-02 10:07:33 编辑
关于这个问题我网上翻了很多帖子,常见的问题我都检查了,autopostback设置为true了,page_load里面的数据绑定也写在if(!ispostback)里了。打断点跟踪第一次绑定数据正常,后面更改dropdownlist的选择时也正常触发回发,但是判断if(!ispostback) 不成立后,就不知道执行到哪里去了。反正页面表现是不管选择哪一个,dropdownlist的内容都是回到第一个,感觉是全部重新绑定了。实在是没辙了,请各位指教,代码片段如下
设备布局号要根据设备类型重新绑定数据
前台:
<div class="rowElem">  
                   <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                         <ContentTemplate>                  
                <label>  
                    设备类型:</label>
                               <asp:DropDownList id="equipmenttype" AutoPostBack="True" OnSelectedIndexChanged="Selection_Change" runat="server" enableviewstate="true">
        </asp:DropDownList>    
                              </ContentTemplate>
                     </asp:UpdatePanel>                    
            </div>
               
                 <div class="rowElem">
                   <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                         <ContentTemplate>  
                <label>  
                    设备布局号:</label>
                               <asp:DropDownList id="equipment"  runat="server">
        </asp:DropDownList>
                        </ContentTemplate>
                     </asp:UpdatePanel>    
            </div>

后台: