简体   繁体   English

UpdatePanel上的AsyncPostBackTrigger和PostBackTrigger之间的区别?

[英]Difference between AsyncPostBackTrigger and PostBackTrigger on UpdatePanel?

I have a GridView (ucLAD) in my UpdatePanel (upnlListing). 我的UpdatePanel (upnlListing)中有一个GridView (ucLAD)。 Inside my ucLAD I have a checkbox and an action for rowClicked : 在我的ucLAD里面,我有一个复选框和rowClicked的动作:

<asp:UpdatePanel ID="upnlListing" runat="server" >
     <Triggers>
        <asp:AsyncPostBackTrigger ControlID="ucLAD"/>
        <%-- <asp:PostBackTrigger ControlID="ucLAD"/> --%>
     </Triggers>
     <ContentTemplate>
        <asp:Panel ID="pnlRequest" runat="server" style="margin-top:15px; height: auto;">
             <ucgv:BaseGrid runat="server" ID="ucLAD"/>
        </asp:Panel>

     </ContentTemplate>  
</asp:UpdatePanel>

When I use the PostBackTrigger the action performed would be the rowClicked same thing happen when I check the checkbox but when I use the AsyncPostBackTrigger , I can check the checkboxes but when I click the row, the action for rowClicked don't trigger. 当我使用PostBackTrigger ,执行的操作将是rowClicked当我检查复选框时发生同样的事情但是当我使用AsyncPostBackTrigger ,我可以检查复选框但是当我单击该行时, rowClicked操作不会触发。 How can I fix this? 我怎样才能解决这个问题?

As describe in on of the SO question 正如SO问题所描述的那样

What is the difference between AsyncPostBackTrigger & PostBackTrigger? AsyncPostBackTrigger和PostBackTrigger有什么区别?

Controls inside an UpdatePanel by default cause a partial page update, controls outside cause a postback, using these triggers it is possible to change this behaviour as required. 默认情况下,UpdatePanel内部的控件会导致部分页面更新,外部控件会导致回发,使用这些触发器可以根据需要更改此行为。

From http://seminaarit.codezone.fi/video/devdays-2007/track1/2/2-ASP-dotNET_AJAX_Extensions.ppt 来自http://seminaarit.codezone.fi/video/devdays-2007/track1/2/2-ASP-dotNET_AJAX_Extensions.ppt

AsyncPostBackTrigger AsyncPostBackTrigger

Converts postbacks into async callbacks Typically used to trigger updates when controls outside an UpdatePanel post back If ChildrenAsTriggers="false", can be used to specify which controls inside UpdatePanel should call back rather than post back 将回发转换为异步回调通常用于在UpdatePanel回调之外的控件后触发更新如果ChildrenAsTriggers =“false”,可用于指定UpdatePanel内的哪些控件应该回调而不是回发

PostBackTrigger PostBackTrigger

Lets controls inside UpdatePanel post back Typically used to allow certain controls to post back when ChildrenAsTriggers="true 让UpdatePanel内部的控件回发通常用于允许某些控件在ChildrenAsTriggers =“true”时回发

Theoretical explain for AsyncPostBackTrigger and PostBackTrigger above is absolutely Correct. 上面的AsyncPostBackTrigger和PostBackTrigger的理论解释绝对是正确的。 Here I gave You example for those two: 在这里,我给了你这两个例子:

<td style="padding-left: 8px;">
     <asp:UpdatePanel  runat="server" ChildrenAsTriggers="false" UpdateMode="conditional">
         <ContentTemplate>
         <asp:RadioButton ID="RBtn_InventoryPriceWithPurchase" Text="Inventory Price With Purchase" GroupName="ReportAnalysis" runat="server" AutoPostBack="True" OnCheckedChanged="RBtn_InventoryPriceWithPurchase_CheckedChanged"/>
         </ContentTemplate>
          <Triggers>
           <asp:AsyncPostBackTrigger ControlID="RBtn_InventoryPriceWithPurchase"EventName="CheckedChanged"/>
          </Triggers>
          </asp:UpdatePanel>
</td>

<td style="padding-left: 8px;">
    <asp:UpdatePanel runat="server" ChildrenAsTriggers="True" UpdateMode="Always">
     <ContentTemplate>
  <asp:RadioButton ID="RBtn_MerchandisingReport" Text="Merchandising Report" GroupName="ReportAnalysis" runat="server" AutoPostBack="True" OnCheckedChanged="RBtn_MerchandisingReport_CheckedChanged" />
  </ContentTemplate>
  <Triggers>
 <asp:PostBackTrigger ControlID="RBtn_MerchandisingReport"/>
 /Triggers>
 </asp:UpdatePanel>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 asyncpostbacktrigger控件内的postbacktrigger控件? - Postbacktrigger control within asyncpostbacktrigger control? UpdatePanel AsyncPostBackTrigger会回发 - UpdatePanel AsyncPostBackTrigger does Postback AsyncPostBackTrigger只是闪烁/滑动UpdatePanel而不更新它 - AsyncPostBackTrigger Just flashing/flicking the UpdatePanel but not updating it ASP.NET DropDownList SelectedIndexChanged与UpdatePanel AsyncPostBackTrigger - ASP.NET DropDownList SelectedIndexChanged with UpdatePanel AsyncPostBackTrigger 带有 PostBackTrigger 的 UpdatePanel 不会更新其外部的标签并在回发后继续 - UpdatePanel with PostBackTrigger does not update the Label outside it and carry on after postbacks asp.net updatePanel PostBackTrigger触发完整的回发 - asp.net updatePanel PostBackTrigger triggering full postback 使用checkedChanged EventHandler将PostBackTrigger和AsyncPostBackTriggers添加到UpdatePanel以获取动态生成的复选框 - Adding PostBackTrigger and AsyncPostBackTriggers to UpdatePanel for dynamically generated checkboxes with checkedChanged EventHandler 如何以编程方式注册AsyncPostBackTrigger时将UpdatePanel设置为自动更新? - How to set UpdatePanel to automatically update while registering AsyncPostBackTrigger programmatically? 在AsyncPostBackTrigger计时器计时完成之前,是否不会触发updatepanel中的转发器中的按钮单击? - Button click in repeater in updatepanel not triggered until AsyncPostBackTrigger timer tick? 在Updatepanel内部触发PostBackTrigger时,scriptmanager.registerstartupscript不起作用。 为什么? - scriptmanager.registerstartupscript not working when PostBackTrigger fire inside updatepanel. why?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM