Telerik is a leading vendor of ASP.NET AJAX, ASP.NET MVC, Silverlight, WinForms and WPF controls and components, as well as .NET Reporting, .NET ORM , .NET CMS, Code Analysis, Mocking, Team Productivity and Automated Testing Tools. Building on its expertise in interface development and Microsoft technologies, Telerik helps customers build applications with unparalleled richness, responsiveness and interactivity. Telerik products help thousands of companies to be more productive and deliver reliable applications under budget and on time.
Version Q2 2011 released 07/12/2011
select

Ajax / Templates and Transparency

Configurator
Select loading image:
Change Transparency in percentage:

  


  • This example illustrates how you can define different Templates for the RadAjaxLoadingPanel control to display custom images during an ajax requeslt.

    It also demonstrates the Transparency feature of AJAX Loading Panel which allows showing the loading panel without hiding the updated control.

    A "replacing" effect could still be achieved - in case of no transparency (value 0), the updated control will be "replaced" by the loading panel during the AJAX update.

    The transparency of the loadng panel is set in percentage. Default value is 0 - loading panel is not transparent and covers the updated control. Value of 100 will make the loading fully transparent.

    You can change the transparency value to achieve any desired effect.

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page Language="c#" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.AJAXExamplesCSharp.AJAX.Examples.LoadingPanel.Transparency.DefaultCS" %>

    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register TagPrefix="telerik" TagName="Header" Src="~/Common/Header.ascx" %>
    <%@ Register TagPrefix="telerik" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
    <%@ Register TagPrefix="telerik" TagName="Footer" Src="~/Common/Footer.ascx" %>
    <%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <telerik:HeadTag runat="server" ID="Headtag1"></telerik:HeadTag>
        <!-- custom head section -->
        <style type="text/css">
            .module1
            {
                background-color: #dff3ff;
                border: 1px solid #c6e1f2;
            }
            .loading
            {
                background-color: #fff;
                height:100%;
                width:100%;
            }
        </style>
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function RequestStart(sender, eventArgs) {
                var loadingImage = document.getElementById('<%= RadAjaxLoadingPanel1.FindControl("Image1").ClientID %>');
                var panel1 = $get("<%= Panel1.ClientID %>");
                loadingImage.style.position = "relative";
                loadingImage.style.top = (parseInt(panel1.style.height) / 2) + "px";
            }
            function MyClientShowing(sender, args) {
                args.get_loadingElement().style.border = "2px solid red";
                args.set_cancelNativeDisplay(true);
                $telerik.$(args.get_loadingElement()).show("slow");
            }

            function MyClientHiding(sender, args) {
                args.get_loadingElement().style.border = "2px solid blue";
                args.set_cancelNativeDisplay(true);
                $telerik.$(args.get_loadingElement()).hide("slow");
            }
        </script>
        </telerik:RadCodeBlock>
        <!-- end of custom head section -->
    </head>
    <body class="BODY">
        <form runat="server">
        <telerik:Header runat="server" ID="Header1" XhtmlCompliant="true" NavigationLanguage="CS" ShowSkinChooser="false">
        </telerik:Header>
        <!-- content start -->
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="Panel1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="Button1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadioButtonList1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="CheckBox1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
            <ClientEvents OnRequestStart="RequestStart" />
        </telerik:RadAjaxManager>
        <qsf:ConfiguratorPanel runat="server" ID="ConfigurationPanel1" Title="Configurator"
            Expanded="true">
            <table>
                <tr>
                    <td style="width: 350px">
                        Select loading image:<br />
                        <asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged">
                            <asp:ListItem Value="loading1.gif" Selected="True" Text="&nbsp;<img src='../../../Img/loading1.gif' alt='loading'/>"></asp:ListItem>
                            <asp:ListItem Value="loading2.gif" Text="&nbsp;<img src='../../../Img/loading2.gif' alt='loading'/>"></asp:ListItem>
                            <asp:ListItem Value="loading3.gif" Text="&nbsp;<img src='../../../Img/loading3.gif' alt='loading'/>"></asp:ListItem>
                            <asp:ListItem Value="loading4.gif" Text="&nbsp;<img src='../../../Img/loading4.gif' alt='loading'/>"></asp:ListItem>
                            <asp:ListItem Value="loading5.gif" Text="&nbsp;<img src='../../../Img/loading5.gif' alt='loading'/>"></asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                    <td valign="top">
                        Change Transparency in percentage:<br /><br />
                        <telerik:RadNumericTextBox ID="RadNumericTextBox1" runat="server" MinValue="0" MaxValue="100" Width="25px" Value="30">
                            <NumberFormat DecimalDigits="0" />
                        </telerik:RadNumericTextBox>&nbsp;&nbsp;
                        <asp:Button ID="Button1" runat="server" Text="Set new value" CssClass="qsfButtonBig" OnClick="Button1_Click" /><br /><br />
                        <asp:CheckBox ID="CheckBox1" runat="server" Text="Enable RadAjaxLoadingPanel animation" AutoPostBack="true" />
                    </td>
                </tr>
            </table>
        </qsf:ConfiguratorPanel>
        <fieldset class="module1">
            <asp:Panel ID="Panel1" runat="server" HorizontalAlign="Center" Height="275px">
    <asp:Button ID="Button2" runat="server" Text="Click to see the loading image" OnClick="Button2_Click"
    Style="margin-top: 15px; margin-left: 15px" CssClass="qsfButtonBigger" />

            </asp:Panel>
        </fieldset>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="" Transparency="30">
            <div class="loading">
                <asp:Image ID="Image1" runat="server" ImageUrl="~/Ajax/Img/loading1.gif" AlternateText="loading" />
            </div>
        </telerik:RadAjaxLoadingPanel>
        <!-- content end -->
        <telerik:Footer runat="server" ID="Footer1"></telerik:Footer>
        </form>
    </body>
    </html>

Get more than expected!

 
 

Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.

Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.

If you have any questions, do not hesitate to contact us at sales@telerik.com.

Copyright 2002-2024 © Telerik. All right reserved
Telerik Inc, 201 Jones Rd, Waltham, MA 02451