UpdatePanel中具有DropDownList的页面回发 [英] Page Postback with DropDownList inside UpdatePanel

查看:53
本文介绍了UpdatePanel中具有DropDownList的页面回发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我面临的问题是我几个小时的研究无法解决!

我真的需要你的帮助...

我想将页面回发到页面上的内容字段,当我选择下拉列表中的某个项目时,该字段会在单击按钮时被填充...

在UpdatePanel的内容中,我具有下拉列表和用于填充下拉列表的按钮...单击按钮时一切正常...但是问题是,当我单击下拉列表中的某个项目时,不回发(刷新)整个页面)..

我的代码在哪里.

Hi all, I''m facing a problem that I can''t solve with hours of research!

I really need your help...

I want to postback my page to content fields on my page get filled when I select an item of my dropdownlist that is filled when I click on a button...

Inside the contents of the UpdatePanel I have the dropdownlist and the button to fill dropdownlist... Everything goes fine when i click the button... But the problem is when i click on an item of my dropdownlist don''t postback (refresh whole page)..

Where is my code.

   <asp:ScriptManager ID="ScriptManager1" runat="server">
      </asp:ScriptManager> 

    <div>


<asp:UpdatePanel ID="PleaseWaitPanel" runat="server" RenderMode="Inline">
                <ContentTemplate>

                        <asp:DropDownList ID="cmbTrabalhador" runat="server" Width="300px" 

                            style="margin-left:-4px;" AutoPostBack="True" onselectedindexchanged="cmbTrabalhador_SelectedIndexChanged">
                     
                        </asp:DropDownList>

                 <asp:Button ID="cmdpreenche" runat="server" Text="Preencher/Actualizar Lista" 

                        OnClick="cmdpreenche_Click" />

          </ContentTemplate>
          <triggers>
                   <asp:AsyncPostBackTrigger ControlID="cmbTrabalhador"  EventName="SelectedIndexChanged" />
        </triggers>
            </asp:UpdatePanel>

    </div>

    <asp:Panel ID="PleaseWaitMessagePanel" runat="server" CssClass="modalPopup" Height="50px"

            Width="125px">
            Please wait<br />
            <img src="img/ajax-loader.gif" alt="Please wait" /></asp:Panel>
     <asp:Button ID="HiddenButton" runat="server" CssClass="hidden" Text="Hidden Button"

            ToolTip="Necessary for Modal Popup Extender" />

        <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BehaviorID="PleaseWaitPopup" TargetControlID="HiddenButton" PopupControlID="PleaseWaitMessagePanel" BackgroundCssClass="modalBackground">
        </asp:ModalPopupExtender>

推荐答案

您的意思不太清楚但是问题是,当我单击下拉列表中的某个项目时,不回发(刷新整个页面).

让我告诉您您的页面设计在做什么:
1.您的更新面板中有两个控件-butotn和dropdownlist,
2.您定义了一个异步触发器

现在,基于以上2,发生以下情况:
1.下拉选择的更改异步发生,并且部分更新了更新面板
2.单击按钮部分更新更新面板.

默认情况下,不需要定义异步触发器,因为默认情况下,UpdatePanel回发页面中的控件是异步的.


现在,如果要对下拉列表值进行完整的页面回发,则需要使用PostBackTrigger而不是AsyncPostBackTrigger.
Not too clear by what you mean But the problem is when i click on an item of my dropdownlist don''t postback (refresh whole page)..

Let me tell what your page design is doing:
1. You have two controls in your update panel - butotn and dropdownlist,
2. You have one async trigger defined

Now, based on above 2, following happens:
1. Dropdown selected change happens asynchronously and partially updates update panel
2. Button click partially updates update panel.

Async trigger defined was not needed as by default the controls in UpdatePanel postsback page asynchronously.


Now, if you wanted to have a complete page postback on dropdown values selection, then you need to use PostBackTrigger instead of AsyncPostBackTrigger.


我替换了ContentTemplate内的所有正文内容UpdatePanel标记正确填充我的所有字段,但是当我按"cmdPreenche"按钮时,我的加载屏幕不会停止加载...仅使用dropdownlist和ContentTemplate标记内的按钮都可以正常工作,但存在我引用的问题关于我上面的最后一个问题...
I replaced all my body content inside the ContentTemplate tags of UpdatePanel to fill all my fields correctly but when I press the "cmdPreenche" button my loading screen don''t stops from loading... With only dropdownlist and button inside the ContentTemplate tags all works fine but with the problem that I refered on my last question above...


这篇关于UpdatePanel中具有DropDownList的页面回发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆