I have a GridView(ucLAD) in my UpdatePanel(upnlListing). Inside my ucLAD I have a checkbox and an action for 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. How can I fix this?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
As describe in on of the SO question
What is the difference between 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.
From http://seminaarit.codezone.fi/video/devdays-2007/track1/2/2-ASP-dotNET_AJAX_Extensions.ppt
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
PostBackTrigger
Lets controls inside UpdatePanel post back
Typically used to allow certain controls to post back when ChildrenAsTriggers=”true
Method 2
Theoretical explain for AsyncPostBackTrigger and PostBackTrigger above is absolutely Correct.
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>
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0