Problem:
when an update panel within a modal popup does an async postback is passes the following if statement located in the Page_Load:
if (!IsPostBack && !IsCallback && !ScriptManager1.IsInAsyncPostBack)
{
}
IsPostBack = false
IsCallBack = false
ScriptManager1.IsInAsyncPostBack = false
Expected Results:
The code within the 'if' statement should only execute on initial page load
Misc:
The modal popup is triggered server side using 'ModalPopupExtender.Show();'
Source:
<asp:Panel ID="Panel" runat="server" CssClass="ModalPopup">
<asp:Panel ID="DragHandlePanel" runat="server" CssClass="modalPopupDragHandle">
Panel Header Text
</asp:Panel>
<br />
<div>
<asp:UpdatePanel ID="UpdatePanel" runat="server">
<ContentTemplate>
<asp:Panel ID="SelectionPanel" runat="server">
<asp:GridView ID="SelectionGridView" runat="server" AutoGenerateColumns="False"
ShowHeader="true" OnRowCommand="SelectionGridView_RowCommand" OnRowDataBound="SelectionGridView_RowDataBound"
DataKeyNames="Id">
<Columns>
<asp:CommandField ButtonType="Image" SelectImageUrl="~/images/smoothicons/icons/arrow_turn_right_2.png"
ShowCancelButton="False" ShowSelectButton="True" />
<asp:BoundField HeaderText="Name" ShowHeader="true" />
<asp:BoundField HeaderText="Title" ShowHeader="true" />
<asp:BoundField HeaderText="Level" ShowHeader="true" />
<asp:BoundField HeaderText="Scope" ShowHeader="true" />
</Columns>
<RowStyle CssClass="gridRowStyle" />
<SelectedRowStyle BackColor="#F2CE00" />
<AlternatingRowStyle CssClass="gridAlternatingRowStyle" />
<HeaderStyle CssClass="gridHeaderStyle" />
</asp:GridView>
<br />
<asp:Button ID="addButton" runat="server" OnClick="addButton_Click"
Text="Add" /></asp:Panel>
<asp:Panel ID="addPanel" runat="server" Visible="False">
<table>
<tr>
<td>
<asp:Label ID="firstNameTextLabel" runat="server" Text="First Name"></asp:Label></td>
<td>
<asp:TextBox ID="firstNameTextBox" runat="server" ValidationGroup="addValidationGroup"></asp:TextBox></td>
<td>
<asp:RequiredFieldValidator ID="firstNameRequiredFieldValidator" runat="server" ControlToValidate="firstNameTextBox"
ErrorMessage="* Required" ValidationGroup="addValidationGroup" EnableClientScript="False"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>
<asp:Label ID="lastNameTextLabel" runat="server" Text="Last Name"></asp:Label></td>
<td>
<asp:TextBox ID="lastNameTextBox" runat="server" ValidationGroup="addValidationGroup"></asp:TextBox></td>
<td>
<asp:RequiredFieldValidator ID="lastNameRequiredFieldValidator" runat="server" ControlToValidate="lastNameTextBox"
ErrorMessage="* Required" ValidationGroup="addValidationGroup" EnableClientScript="False"></asp:RequiredFieldValidator></td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
<br />
<asp:Button ID="OkButton" runat="server" Text="Ok" ValidationGroup="addValidationGroup"
OnCommand="OkButton_Command" />
<asp:Button ID="CancelButton" runat="server" Text="Cancel" CausesValidation="False"
OnClick="CancelButton_Click" />
</div>
</asp:Panel>
<aspajax:ModalPopupExtender ID="ModalPopupExtender" runat="server" TargetControlID="PopupHiddenButton"
PopupControlID="Panel" DropShadow="true" BackgroundCssClass="modalBackground"
PopupDragHandleControlID="DragHandlePanel" />
<asp:Button ID="PopupHiddenButton" runat="server" CssClass="hiddenButton" />
Comments: Would you provide a complete sample project?
when an update panel within a modal popup does an async postback is passes the following if statement located in the Page_Load:
if (!IsPostBack && !IsCallback && !ScriptManager1.IsInAsyncPostBack)
{
}
IsPostBack = false
IsCallBack = false
ScriptManager1.IsInAsyncPostBack = false
Expected Results:
The code within the 'if' statement should only execute on initial page load
Misc:
The modal popup is triggered server side using 'ModalPopupExtender.Show();'
Source:
<asp:Panel ID="Panel" runat="server" CssClass="ModalPopup">
<asp:Panel ID="DragHandlePanel" runat="server" CssClass="modalPopupDragHandle">
Panel Header Text
</asp:Panel>
<br />
<div>
<asp:UpdatePanel ID="UpdatePanel" runat="server">
<ContentTemplate>
<asp:Panel ID="SelectionPanel" runat="server">
<asp:GridView ID="SelectionGridView" runat="server" AutoGenerateColumns="False"
ShowHeader="true" OnRowCommand="SelectionGridView_RowCommand" OnRowDataBound="SelectionGridView_RowDataBound"
DataKeyNames="Id">
<Columns>
<asp:CommandField ButtonType="Image" SelectImageUrl="~/images/smoothicons/icons/arrow_turn_right_2.png"
ShowCancelButton="False" ShowSelectButton="True" />
<asp:BoundField HeaderText="Name" ShowHeader="true" />
<asp:BoundField HeaderText="Title" ShowHeader="true" />
<asp:BoundField HeaderText="Level" ShowHeader="true" />
<asp:BoundField HeaderText="Scope" ShowHeader="true" />
</Columns>
<RowStyle CssClass="gridRowStyle" />
<SelectedRowStyle BackColor="#F2CE00" />
<AlternatingRowStyle CssClass="gridAlternatingRowStyle" />
<HeaderStyle CssClass="gridHeaderStyle" />
</asp:GridView>
<br />
<asp:Button ID="addButton" runat="server" OnClick="addButton_Click"
Text="Add" /></asp:Panel>
<asp:Panel ID="addPanel" runat="server" Visible="False">
<table>
<tr>
<td>
<asp:Label ID="firstNameTextLabel" runat="server" Text="First Name"></asp:Label></td>
<td>
<asp:TextBox ID="firstNameTextBox" runat="server" ValidationGroup="addValidationGroup"></asp:TextBox></td>
<td>
<asp:RequiredFieldValidator ID="firstNameRequiredFieldValidator" runat="server" ControlToValidate="firstNameTextBox"
ErrorMessage="* Required" ValidationGroup="addValidationGroup" EnableClientScript="False"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>
<asp:Label ID="lastNameTextLabel" runat="server" Text="Last Name"></asp:Label></td>
<td>
<asp:TextBox ID="lastNameTextBox" runat="server" ValidationGroup="addValidationGroup"></asp:TextBox></td>
<td>
<asp:RequiredFieldValidator ID="lastNameRequiredFieldValidator" runat="server" ControlToValidate="lastNameTextBox"
ErrorMessage="* Required" ValidationGroup="addValidationGroup" EnableClientScript="False"></asp:RequiredFieldValidator></td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
<br />
<asp:Button ID="OkButton" runat="server" Text="Ok" ValidationGroup="addValidationGroup"
OnCommand="OkButton_Command" />
<asp:Button ID="CancelButton" runat="server" Text="Cancel" CausesValidation="False"
OnClick="CancelButton_Click" />
</div>
</asp:Panel>
<aspajax:ModalPopupExtender ID="ModalPopupExtender" runat="server" TargetControlID="PopupHiddenButton"
PopupControlID="Panel" DropShadow="true" BackgroundCssClass="modalBackground"
PopupDragHandleControlID="DragHandlePanel" />
<asp:Button ID="PopupHiddenButton" runat="server" CssClass="hiddenButton" />
Comments: Would you provide a complete sample project?