Solved

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

Posted on 2008-10-26
5
7,150 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
ID: 22809327
0
 
LVL 10

Accepted Solution

by:
jinn_hnnl earned 500 total points
ID: 22810670
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
ID: 31510153
You rock!
Thanks :)
0
 

Expert Comment

by:tfsln
ID: 23481598
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
ID: 25251589
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 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