2011-05-24 51 views
0

後有一個下拉列表綁定數據源 - >稱這個DropDownList的一個 這個數據源獲取從另一個下拉列表另一個參數 - >稱這個DropDownList中乙與參數化數據源綁定DROPDOWNLIST不守值回傳

每次DropDownList B更改選定的值,下拉列表A的數據源將接收參數並更改下拉列表A.

每當DropDownlist更改其索引時,都會導致回發,並且所選值將重置爲第一個索引(默認值)。

切換後DropDownList A使用不帶參數的數據源。這個問題不會發生。 DropDownList A更改了它的值並回發之後,最近更改的值仍然存在。

我試過使用更新面板,但它仍然不工作。

這是DropDownList的B,添加在類型

        <asp:DropDownList ID="ddlAddOnType" runat="server" AppendDataBoundItems="True" 
             AutoPostBack="True" ClientIDMode="Static" CssClass="controlOrdinary" 
             DataSourceID="odsAddOnType" DataTextField="AddOnTypeName" 
             DataValueField="AddOnTypeId" 
             onselectedindexchanged="ddlAddOnType_SelectedIndexChanged" Width="208px"> 
             <asp:ListItem Value="0">--Please Select--</asp:ListItem> 
            </asp:DropDownList> 

這是數據源的DROPDOWNLIST一個

      <asp:ObjectDataSource ID="odsAddon" runat="server" 
           SelectMethod="SelectAddOnThatIsNotInCurrentPromotionWithAddOnByAddOnTypeId" 
           TypeName="BackOfficeLib.SupportAdmin.PromotionBinder"> 
           <SelectParameters> 
            <asp:ControlParameter ControlID="ddlAddOnType" Name="pIntAddOnTypeId" 
             PropertyName="SelectedValue" Type="Int32" /> 
           </SelectParameters> 
          </asp:ObjectDataSource> 

這是下拉列表A中,當這一變化值,頁是回發突然並且索引被重置。

        <asp:DropDownList ID="ddlAddOn" runat="server" AppendDataBoundItems="True" 
             AutoPostBack="True" ClientIDMode="Static" CssClass="controlOrdinary" 
             DataTextField="AddOnName" DataValueField="AddOnId" 
             onselectedindexchanged="ddlAddOn_SelectedIndexChanged" Width="208px"> 
             <asp:ListItem Value="0">--Please Select--</asp:ListItem> 
            </asp:DropDownList> 

回答