Solved

How to hide controls inside UpdatePanel with the UpdateProgress or the UpdatePanelAnimationExtender?

Posted on 2008-10-26
5
7,105 Views
Last Modified: 2012-05-05
Hello Experts!

I'm trying to "Hide" all controls inside the "Update Panel" while the "ajax-loading.gif" controls is show.
My bug is when i click the the "btnOK", the "ajax-loading.gif" is show, but user still able to modify textbox and click on btnOk.

I want to "Hide" or "Disable" access to all controls inside the "update panel" when the updateprogress occur.
When it's finish i want to show back to button to the user.

Any idea, solution or code exemple?

Thanks!
page.aspx

----------------------

<asp:Panel runat="server" ID="panContent" CssClass="ajax_ModalPopup" Style="display: none">

  <asp:UpdatePanel ID="updtPanelModalPopup" runat="server">

    <ContentTemplate>

      Login:<asp:TextBox ID="txtUser" runat="server"></asp:TextBox><br />

      Pass:<asp:TextBox ID="txtPass" runat="server"></asp:TextBox><br />

      <asp:Button ID="btnOk" runat="server" Text="LogOn" />

    </ContentTemplate>

  </asp:UpdatePanel>

  <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="updtPanelModalPopup" DynamicLayout="true">

     <ProgressTemplate>

        <img alt="" src="/Images/ajax-loading.gif" />

      </ProgressTemplate>

  </asp:UpdateProgress>

</asp:Panel>

 

<ajaxToolkit:ModalPopupExtender runat="server" ID="modalPopupCtrl"

    PopupControlID="panContent" 

    CancelControlID="btnClose"

    BackgroundCssClass="ajax_ModalPopupBackground"/>
 
 

page.aspx.cs

----------------------

void btnOk_Click(object sender, EventArgs e){

    System.Threading.Thread.Sleep(3000);}

Open in new window

0
Comment
Question by:jabcoco
5 Comments
 
LVL 13

Expert Comment

by:sm394
Comment Utility
0
 
LVL 10

Accepted Solution

by:
jinn_hnnl earned 500 total points
Comment Utility
The trick that we used in our project is creating the UpdateProgress as a div which overlap all page controls and cover the whole page.

The div I am talking about will have fixed position start at 0;0; width and height is big enough to cover the entire page. the z-index (important key) is higher than any another (let say 100) so it will overlap the rest of the controls -> no controls is accessible during the progress. The div will also have transparency for better layout using filter (standard CSS).

The Css class .modalProgress  has already cover crossing browser problem. the width and the height I put fixed value to make sure it works for you. You can change it to percentage if you want.

Plug it in your code and see how it's look like

JINN



 

.modalProgress

{ 

	clear:both; 

	float:left; 	

	margin:0px;

	z-index:100;

	position:absolute;

	left:0px;

	top:0px;

	width:1200px;

	height:1000px;			

	background-color:Gray; 

	filter:alpha(opacity=50);

	opacity:0.5;

	-moz-opacity:0.5;

	-khtml-opacity: 0.5;

}
 

<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="updtPanelModalPopup" DynamicLayout="true">

   <ProgressTemplate>

        <div class="modalProgress">

	   Loading... please wait.... <br />

	   <img alt="" src="/Images/ajax-loading.gif" />

        </div>

   </ProgressTemplate>

</asp:UpdateProgress>

Open in new window

0
 
LVL 10

Author Closing Comment

by:jabcoco
Comment Utility
You rock!
Thanks :)
0
 

Expert Comment

by:tfsln
Comment Utility
Would it also be possible for users to use the Tab button to give focus to the overlapped controls, thus meaning it would technically be possible for users to click buttons and such during processing?
0
 

Expert Comment

by:akshara
Comment Utility
Hi Jinn,

           I am trying to use the same code to hide controls on my page. When i have buttons on the screen, all controls are overlap but it is not happening when i have grid on the page. Below is my html. Could you please help me to resolve this?

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Untitled Page</title>
 <link href="StyleSheet.css" rel="Stylesheet" type="text/css" />
 
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
           
    </div>
   
      <table style="width:55%;">
            <tr>
                <td>
                    <table><tr><td>
                    <asp:UpdatePanel ID="InsertEmployeeUpdatePanel" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                          <table cellpadding="2" border="0" style="background-color:#7C6F57">
                            <tr>
                              <td><asp:Label ID="FirstNameLabel" runat="server" AssociatedControlID="FirstNameTextBox"
                                             Text="First Name" ForeColor="White" /></td>
                              <td><asp:TextBox runat="server" ID="FirstNameTextBox" /></td>
                            </tr>
                            <tr>
                              <td><asp:Label ID="LastNameLabel" runat="server" AssociatedControlID="LastNameTextBox"
                                             Text="Last Name" ForeColor="White" /></td>
                              <td><asp:TextBox runat="server" ID="LastNameTextBox" /></td>
                            </tr>
                            <tr>
                              <td></td>
                              <td>
                                <asp:LinkButton ID="InsertButton" runat="server" Text="Insert" OnClick="InsertButton_Click" ForeColor="White" />
                                <asp:LinkButton ID="InsertButton1" runat="server" Text="Insert 1"  
                                      ForeColor="White" onclick="InsertButton1_Click" />
                                <asp:LinkButton ID="InsertButton2" runat="server" Text="Insert 2"  
                                      ForeColor="White" onclick="InsertButton2_Click" />
                              </td>
                            </tr>
                          </table>
                          <asp:Label runat="server" ID="InputTimeLabel"><%=DateTime.Now %></asp:Label>
                        </ContentTemplate>
                    </asp:UpdatePanel>

                   
                    </td></tr></table></td>
                    <td><table>
                    <tr>
                    <td>
                    <asp:UpdatePanel ID="EmployeesUpdatePanel" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                            <asp:GridView ID="EmployeesGridView" runat="server" BackColor="LightGoldenrodYellow" BorderColor="Tan"
                                BorderWidth="1px" CellPadding="2" ForeColor="Black" GridLines="None" AutoGenerateColumns="False">
                                <FooterStyle BackColor="Tan" />
                                <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
                                <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
                                <HeaderStyle BackColor="Tan" Font-Bold="True" />
                                <AlternatingRowStyle BackColor="PaleGoldenrod" />
                                <Columns>
                                    <asp:BoundField DataField="EmployeeID" HeaderText="Employee ID" />
                                    <asp:BoundField DataField="LastName" HeaderText="Last Name" />
                                    <asp:BoundField DataField="FirstName" HeaderText="First Name" />
                                </Columns>
                                <PagerSettings PageButtonCount="5" />
                            </asp:GridView>
                            <asp:Label runat="server" ID="ListTimeLabel"><%=DateTime.Now %></asp:Label>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="InsertButton" EventName="Click" />
                        </Triggers>
                    </asp:UpdatePanel>

                    </td>
                    </tr>
                    <tr>
                    <td>
                    <asp:UpdatePanel ID="UpdatePanel4" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                            <asp:GridView ID="GridView1" runat="server" BackColor="LightGoldenrodYellow" BorderColor="Tan"
                                BorderWidth="1px" CellPadding="2" ForeColor="Black" GridLines="None" AutoGenerateColumns="False">
                                <FooterStyle BackColor="Tan" />
                                <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
                                <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
                                <HeaderStyle BackColor="Tan" Font-Bold="True" />
                                <AlternatingRowStyle BackColor="PaleGoldenrod" />
                                <Columns>
                                    <asp:BoundField DataField="EmployeeID" HeaderText="Employee ID" />
                                    <asp:BoundField DataField="LastName" HeaderText="Last Name" />
                                    <asp:BoundField DataField="FirstName" HeaderText="First Name" />
                                </Columns>
                                <PagerSettings PageButtonCount="5" />
                            </asp:GridView>
                            <asp:Label runat="server" ID="Label4"><%=DateTime.Now %></asp:Label>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="InsertButton1" EventName="Click" />
                        </Triggers>
                    </asp:UpdatePanel>

                    </td>
                    </tr>
                    <tr>
                    <td>
                    <asp:UpdatePanel ID="UpdatePanel5" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                            <asp:GridView ID="GridView2" runat="server" BackColor="LightGoldenrodYellow" BorderColor="Tan"
                                BorderWidth="1px" CellPadding="2" ForeColor="Black" GridLines="None" AutoGenerateColumns="False">
                                <FooterStyle BackColor="Tan" />
                                <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
                                <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
                                <HeaderStyle BackColor="Tan" Font-Bold="True" />
                                <AlternatingRowStyle BackColor="PaleGoldenrod" />
                                <Columns>
                                    <asp:BoundField DataField="EmployeeID" HeaderText="Employee ID" />
                                    <asp:BoundField DataField="LastName" HeaderText="Last Name" />
                                    <asp:BoundField DataField="FirstName" HeaderText="First Name" />
                                </Columns>
                                <PagerSettings PageButtonCount="5" />
                            </asp:GridView>
                            <asp:Label runat="server" ID="Label5"><%=DateTime.Now %></asp:Label>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="InsertButton2" EventName="Click" />
                        </Triggers>
                    </asp:UpdatePanel>

                    </td>
                    </tr>
                    </table></td>
               
            </tr>
           
           
        </table>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="EmployeesUpdatePanel" >
        <ProgressTemplate>
        <div class="modalProgress">
            <img alt="Data is Loading .........." src="Rotator.gif"
    style="width: 100px; height: 100px" />&nbsp; Data is loding in Panel 1
            .............................</div>
        </ProgressTemplate>
    </asp:UpdateProgress>
             

   
    <asp:UpdateProgress ID="UpdateProgress2" runat="server" AssociatedUpdatePanelID="UpdatePanel4" >
        <ProgressTemplate>
        <div class="modalProgress" align="right" >
            <img alt="Panel 2 is Updating ........" src="Rotator.gif"
    style="width: 100px; height: 100px" />&nbsp; Data is loding in Panel 2
            .............................
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
   
    <asp:UpdateProgress ID="UpdateProgress3" runat="server" AssociatedUpdatePanelID="UpdatePanel5" >
        <ProgressTemplate>
        <div class="modalProgress">
            <img alt="Update Panel 3 is Loading ..." src="Rotator.gif"
    style="width: 100px; height: 100px" />
            Data is loding in Panel 3 .............................
            </div>
        </ProgressTemplate>
       
    </asp:UpdateProgress>
   
 
           
    </form>
</body>
</html>

Thanks
Akshara
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now