开发者

How to enable a dropdownlist in an update panel to make a full post back

开发者 https://www.devze.com 2023-04-05 21:24 出处:网络
Q: I have the following case : Two drop down lists : The first one for the camp. The second one for the faculty .

Q:

I have the following case :

Two drop down lists :

  • The first one for the camp.
  • The second one for the faculty .

When the user selects from the camp .I fill the faculty ddl according to his selection.

I put my second ddl in an updatepanel so ,this part of the page only posted back.

but i wanna when i select an item from the second ddl(the faculty one), force full post back to the whole page to view an report .

How to do this .

My aspx:

 <asp:DropDownList ID="ddl_camp_s" runat="server" Width="200px" AutoPostBack="True"
                            开发者_StackOverflow    OnSelectedIndexChanged="ddl_camp_s_SelectedIndexChanged">
                            </asp:DropDownList>

<asp:UpdatePanel ID="UpdatePanel4" runat="server">
                                <ContentTemplate>
                                    <asp:DropDownList ID="ddl_fac_s" runat="server" Width="400px" AutoPostBack="True"
                                        OnSelectedIndexChanged="ddl_fac_s_SelectedIndexChanged">
                                    </asp:DropDownList>
                            </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="ddl_camp_s" 
                                        EventName="SelectedIndexChanged" />
                                </Triggers>
                            </asp:UpdatePanel>


It would be better using cascadingdropdown from ajax control toolkit

http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/CascadingDropDown/CascadingDropDown.aspx


Try add this in your update panel triggers

 <Triggers>
    <asp:PostBackTrigger ControlID="ControlIdToForceFullPOstBack" />
 </Triggers>

Hope this help

0

精彩评论

暂无评论...
验证码 换一张
取 消