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

XmlHttpPanel / Dynamically Loading Controls

Select a word from the news below to open a window with its dictionary definiton.


Telerik is adding a new product to its portfolio! Maybe you are already aware of that thanks to the numerous blog posts and comments in the press. What you might be still curious to learn, though, is how Telerik will keep its promise of opening a new era in automated web testing.

The motivation behind this product is simple - most companies today don't use automated testing! Why? Well, simply because the current tools are very complex, very expensive and very generic. If you want to test a slick web 2.0 application with more-than-basic interactivity you simply can't. And if you are using AJAX or client-side functionality (which is something standard nowadays, right) - well, forget about it. Learning today's testing tools takes forever and the price tag is just ... too high to say the least.

These times are over now. Automated web testing is finally made simple, powerful and accurate. Telerik WebUI Test Studio (powered by ArtOfTest) is designed specifically for modern web applications, which may use AJAX or even Silverlight (coming soon). There are plenty of tools and features specifically for web testing - browser abstraction (yes, indeed), convenient DOM inspector, reuse of HTML elements, etc. The Test Studio uses a true point-and-click interface so you will no longer deal with recording script files or consoles. Finally, this elegant solution is priced very affordably and supports Visual Studio Professional Edition (not just VSTS).




  • Dynamically Loading Controls in XmlHttpPanel

    This example demonstrates a common usage of the RadXmlHttpPanel - as a place holder to load controls on-demand. This allows you to improve the performance of the page by placing only a RadXmlHttpPanel, and loading any other controls only when needed.

    The RadToolTip and the RadWindowManager are not present on the page until a word is selected. When the user selects a word (or double-clicks it) for the first time, a partial page update is initialized and the RadXmlHttpPanel loads both of the controls (the RadToolTip and the RadWindowManager). Any other word selection after that, are handled on the client.

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page Language="vb" AutoEventWireup="true" Inherits="Telerik.Web.Examples.XmlHttpPanel.WindowInXmlHttpPanel.DefaultVB"
        CodeFile="DefaultVB.aspx.vb" %>

    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
    <%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <qsf:HeadTag ID="Headtag1" runat="server" />
        <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
            <script type="text/javascript">
                var searchString = "";
                function OnClientBeforeShow(tooltip, args)
                {
                    if (!searchString)
                    {
                        args.set_cancel(true);
                    }
                }

                function DisplayHelp(event)
                {
                    var tooltip = $find("RadToolTip1");
                    if (window.document.selection)
                    {
                        var rng = window.document.selection.createRange();
                        searchString = rng.text;
                    }
                    else if (window.getSelection)
                    {
                        searchString = window.getSelection().toString();
                    }
                    if (searchString)
                    {
                        var urlSearchString = "http://www.answers.com/topic/" + searchString;

                        if (tooltip)
                        {
                            tooltip.set_offsetX(0);
                            tooltip.set_offsetY(0);

                            tooltip.show();
                        }
                        else
                        {
                            var posx = 0;
                            var posy = 0;
                            if (!event) var event = window.event;
                            if (event.pageX || event.pageY)
                            {
                                posx = event.pageX;
                                posy = event.pageY;
                            }
                            else if (event.clientX || event.clientY)
                            {
                                posx = event.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
                                posy = event.clientY + document.body.scrollTop + document.documentElement.scrollTop;
                            }

                            var divLocation = $telerik.getLocation($get("textDiv"));
                            posx = posx - divLocation.x;
                            posy = posy - divLocation.y;

                            urlSearchString = urlSearchString + "|" + posx + "|" + posy;

                            var panel = $find("RadXmlHttpPanel1");
                            panel.set_value(urlSearchString);
                        }
                    }
                    else if (tooltip)
                    {
                        tooltip.hide();
                    }
                }

                function OnClientResponseEnded(panel, args)
                {
                    var tooltip = $find("RadToolTip1");
                    tooltip.show();
                }

                function OpenWindow()
                {
                    if (searchString)
                    {
                        $find("RadToolTip1").hide();
                        var urlSearchString = "http://www.answers.com/topic/" + searchString;
                        window.radopen(urlSearchString, "InfoPopup");
                    }
                }
            </script>
        </telerik:RadScriptBlock>
    </head>
    <body class="BODY">
        <form id="Form2" method="post" runat="server">
        <qsf:Header ID="Header1" runat="server" NavigationLanguage="VB" ShowSkinChooser="false" />
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <div style="background: url('back.png') no-repeat; background-position: center; height: 600px;
            margin: 0 auto; position: relative; top: 20px;">
            <div id="textDiv" style="font: 1em/1.2em 'Arial', sans-serif; width: 550px; margin: 0 auto;
                position: relative; top: 120px;" onmouseup="DisplayHelp(event);return false;">
                <span style="font-size: 15px; text-align: center; color: #1E90FF;">Select a word from
                    the news below to open a window with its dictionary definiton.</span>
                <br />
                <br />
                <br />
                <p>
                    <strong>Telerik</strong> is adding a new product to its portfolio! Maybe you are
                    already aware of that thanks to the numerous blog posts and comments in the press.
                    What you might be still curious to learn, though, is how Telerik will keep its promise
                    of opening a new era in automated web testing.</p>
                <p>
                    The motivation behind this product is simple - most companies today don't use automated
                    testing! Why? Well, simply because the current tools are very complex, very expensive
                    and very generic. If you want to test a slick web 2.0 application with more-than-basic
                    interactivity you simply can't. And if you are using AJAX or client-side functionality
                    (which is something standard nowadays, right) - well, forget about it. Learning
                    today's testing tools takes forever and the price tag is just ... too high to say
                    the least.</p>
                <p>
                    These times are over now. Automated web testing is finally made simple, powerful
                    and accurate. <strong>Telerik WebUI Test Studio</strong> (powered by ArtOfTest)
                    is designed specifically for modern web applications, which may use AJAX or even
                    Silverlight (coming soon). There are plenty of tools and features specifically for
                    web testing - browser abstraction (yes, indeed), convenient DOM inspector, reuse
                    of HTML elements, etc. The Test Studio uses a true point-and-click interface so
                    you will no longer deal with recording script files or consoles. Finally, this elegant
                    solution is priced very affordably and supports Visual Studio Professional Edition
                    (not just VSTS).</p>
            </div>
        </div>
        <telerik:RadXmlHttpPanel ID="RadXmlHttpPanel1" runat="server" EnableClientScriptEvaluation="true"
            OnClientResponseEnded="OnClientResponseEnded" OnServiceRequest="XmlHttpPanel1_ServiceRequest"
            RenderMode="Block">
        </telerik:RadXmlHttpPanel>
        <br />
        <br />
        <qsf:Footer runat="server" ID="Footer1" ShowCodeViewer="true" />
        </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