modalpopupextender problem
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: modalpopupextender problem

Hybrid View

  1. #1
    Join Date
    Aug 2000
    Location
    Essex, Uk
    Posts
    1,214

    modalpopupextender problem

    Hi all,

    I've been using the above control for some time with no problem with it working on a button click event.

    However, this time the scenario is slightly different and I need to force the modalpopup to show during the button click event.

    When the user presses my button on a form, I show a messagebox. Depending on the answer, I then either drop out of the click event or I continue. If I continue i want my popup to show since this is basically a progress bar.

    in the aspx page I have :

    Code:
    <asp:Content ID="Content1" ContentPlaceHolderID="content" Runat="Server">
    <cc1:ModalPopupExtender ID="PopUpdate" runat="server" PopupControlID="UpdateProgress1" TargetControlID="btnFake" BackgroundCssClass="modalBackground"></cc1:ModalPopupExtender>
    	
    	<script type="text/javascript">
    	
    	function showScopeGroupPopup()
    	{
    		$get('<%=UpdateProgress1.ClientID %>').className = "modalpopup";
    		$find('<%=PopUpdate.ClientID %>').show();
    		return false;
    	}
    	
    </script>
    and further down at the end of the UpdatePanel i have

    Code:
       </ajax:UpdatePanel>
        <div style="margin-left:95%;"><asp:Button ID="cmdSave" runat="server" Text="Save"/></div>   
        <ajax:UpdateProgress ID="UpdateProgress1"  runat="server" AssociatedUpdatePanelID="AjaxUpdate" DynamicLayout="true" DisplayAfter="0">
            <ProgressTemplate>
                <asp:Panel ID="UpdateProgressPanel" runat="server" Height="154px" Width="154px" BackColor="White" BorderStyle="Solid" HorizontalAlign="center">
                    <center><asp:Image ImageUrl="~/App_Themes/Standard/images/BigAjaxWait.gif" runat="server" ID="imgProgress1" />
                    <p /><b>Refreshing, please wait...</b></center>
                </asp:Panel>
            </ProgressTemplate>
        </ajax:UpdateProgress>
    If I place cmdSave inside the updatepanel, my popup shows as soon as the button is clicked and I do not get my messagebox first. so I've placed it outside the updatepanel.

    In Code assuming the user said yes to the messagebox, I have

    Code:
                PopUpdate.Show()
    but because it's still in the event and no postback has happened the popup does not show and instead my code continues on through.
    If you find my answers helpful, dont forget to rate me

  2. #2
    Join Date
    Aug 2000
    Location
    Essex, Uk
    Posts
    1,214

    Re: modalpopupextender problem

    ok Guys, I was being a bit stupid, I didn't see the confirmextender control and have now implemented that. It nearly works.

    Because my button and the confirmextender is in the update panel, the first time I press my cmdSave button the Progress update get's triggered and so I get my gif flickering on screen for a split second. I then press the cmdSave button a second time and then the confirmExtender kicks in. If I ok or cancel on the extender, the code works fine, and if I cancel multiple times each time I then press my cmd Save the extender shows as expected, so the problem is the very first time my cmdSave is pressed the confirmExtender is overriden by the UpdatePanel.

    Code:
    .....
        </div>
            <div style="margin-left:95%;">
                <asp:Button ID="cmdSave" runat="server" Text="Update" /><cc1:ConfirmButtonExtender ID="cmdSaveExtender" runat="server" TargetControlID="cmdSave">
            </cc1:ConfirmButtonExtender></div>
        </ContentTemplate> 
        </ajax:UpdatePanel>
        <ajax:UpdateProgress ID="UpdateProgress1"  runat="server" AssociatedUpdatePanelID="AjaxUpdate" DynamicLayout="true" DisplayAfter="0" >
            <ProgressTemplate>
                <asp:Panel ID="UpdateProgressPanel" runat="server" Height="154px" Width="154px" BackColor="White" BorderStyle="Solid" HorizontalAlign="center">
                    <center><asp:Image ImageUrl="~/App_Themes/Standard/images/BigAjaxWait.gif" runat="server" ID="imgProgress1" />
                    <p /><b>Refreshing, please wait...</b></center>
                </asp:Panel>
            </ProgressTemplate>
        </ajax:UpdateProgress>

    Code:
       Protected Sub cmdSaveExtender_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdSaveExtender.PreRender
            cmdSaveExtender.ConfirmText = msg()
        End Sub
    If you find my answers helpful, dont forget to rate me

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center