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 Q1 2012 released 04/11/2012
select

Notification / WCF Web Service

Notifier
Elizabeth Lincoln
Roland Mendel
Yoshi Tannamuri
Catherine Dewey
Jean Fresnière
Georg Pipps
Pascale Cartrain


  • Click on a person to see whteher he/she is available for an online conversation.

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page Language="C#" AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.Web.Examples.Notification.Callback.DefaultCS" %>

    <%@ 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" />
        <link href="styles.css" rel="stylesheet" type="text/css" />
    </head>
    <body class="BODY">
        <form id="form1" runat="server">
        <qsf:Header ID="Header1" runat="server" NavigationLanguage="c#" />
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <script type="text/javascript">
            function ShowNotification(arg)
            {
                var notification = $find("<%=RadNotification1.ClientID %>");
                notification.set_value('{"CustomerID":"' + arg + '"}');
                notification.show();
            }

    function OnClientUpdating(sender, args)
    {
        //The actual result data is in the [WcfServiceMethod]Result property of the content object.
        var data = args.get_content().GetCustomerByIDResult,
            customer = $telerik.$.parseJSON(data);
                
        UpdateNotificationData(customer);

        args.set_cancel(true);
    }

            function UpdateNotificationData(customer)
            {
                $telerik.$(".userImg > img").attr("src", "../../../Img/Northwind/Customers/Thumbs/" + customer.CustomerID + ".jpg")
                $telerik.$(".userName").html(customer.ContacName);
                $telerik.$(".userData").html("Hi there! I am currently out of the office. You can reach me by phone at " + customer.Phone + ".");
            }
        </script>
        <div class="notWrapper">
            <div class="notTitle">
                Notifier</div>
            <div class="notCont">
                <asp:Repeater runat="server" ID="itemsRepeater" DataSourceID="SqlDataSource1">
                    <ItemTemplate>
                        <div onclick='<%# String.Format("ShowNotification(\"{0}\")" , Eval("CustomerID")) %>'
                            class="notItems">
                            <div class="notThumb" style="background-image: url('<%# Eval("CustomerID", "Img/{0}.jpg") %>');">
                            </div>
                            <div class="notName">
                                <%# Eval("ContactName") %>
                            </div>
                            <div>
                                <%# GetNote((((System.Data.DataRowView)Container.DataItem)["ContactName"]).ToString())%>
                            </div>
                            <div style="clear: both">
                            </div>
                        </div>
                    </ItemTemplate>
                </asp:Repeater>
            </div>
        </div>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT CustomerID, ContactName FROM [Customers]
                        WHERE Country = 'Austria' OR Country = 'Belgium' OR
                        Country = 'Canada'"></asp:SqlDataSource>
        <telerik:RadNotification ID="RadNotification1" runat="server" Width="320" Animation="Fade"
            EnableRoundedCorners="true" EnableShadow="true" Style="z-index: 35000" LoadContentOn="EveryShow"
            OffsetX="-20" OffsetY="-20" VisibleTitlebar="false"
            WcfRequestMethod="POST"
            WcfServicePath="XmlHttpPanelWcfService.svc"
            WcfServiceMethod="GetCustomerByID"
            OnClientUpdating="OnClientUpdating" >
            <ContentTemplate>
                <div style="margin: 10px 5px 5px 5px;float: left;">
                    <div class="userImg">
                        <asp:Image ID="img" runat="server" alt="" />
                    </div>
                    <div class="userInfo">
                        <span ID="lblName" runat="server" class="userName"></span>
                        <br />
                        <span class="userOffline">offline</span>
                        <span ID="notificationLbl" runat="server" class="userData"></span>
                    </div>
                </div>
            </ContentTemplate>
        </telerik:RadNotification>
        <br />
        <qsf:Footer runat="server" ID="Footer1" />
        </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-2012 © Telerik. All right reserved
Telerik Inc, 201 Jones Rd, Waltham, MA 02451