Telerik has the little Kendo ninja fellow as a constant icon on the bottom right of the window, and after a few seconds, it slides out to ask "Is this article helpful? Yes/No".
My client wants a timed pop-out similar to that on each page, which after 10-15 seconds asks "Do you want more information? Click here to contact us!" and then redirect to our contact page. Or they can click to make it hide away (until the next page).
I'm suspecting the Notification widget will do this, but I'm not sure where to begin or if there is something better for this purpose. Has anyone done something like this?
If you have a page with Telerik UI for ASP.NET AJAX RadHtmlChart and try to add Kendo UI for jQuery Notification to that page...
The JavaScript:
var notif = jqueryobject.kendoNotification({appendTo: "#appendto"}).data("kendoNotification");
You cannot call notif.show() because notif is undefined.
We added a kendoNotification to our skin and on pages that use Telerik UI for ASP.NET AJAX RadHtmlChart causes this problem. Other pages with other Telerik UI for ASP.NET AJAX controls work fine.
We have also seen this issue on one other Telerik UI for ASP.NET AJAX control: RadClientDataSource
Any work-around to get this working?
RadNotification seemingly does not have focus trap
Am i missing something?
I allow the user to create in runtime, zones (my sections) and docks.
<asp:Repeater ID="repSections" runat="server" OnItemDataBound="repSections_ItemDataBound">
<ItemTemplate>
<asp:Panel ID="panelSection" runat="server" CssClass="container">
A RadDockZone(section) and it's RadDocks are injected here in runtime...
</asp:Panel>
</ItemTemplate>
</asp:Repeater>
This repeater is populated from database and zones and it's docks injected in runtime, assigning the DockPositionChanged event to each of the created docks. Since I also inject in runtime, controls before and after each zone to manage it (Add, configure, move up/down) and I want them to postback using ajax, I'm configuring the ajax behavior in the ItemDataBound event of the Repeater:
protected void repSections_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
LinkButton linkbtAddNormalSection = e.Item.FindControl("linkbtAddNormalSection") as LinkButton;
linkbtAddNormalSection.CommandArgument = section.Id.ToString();
AjaxSetting ajaxSetting_linkbtAddNormalSection = new AjaxSetting();
ajaxSetting_linkbtAddNormalSection.AjaxControlID = linkbtAddNormalSection.UniqueID;
ajaxSetting_linkbtAddNormalSection.EventName = "Click";
ajaxSetting_linkbtAddNormalSection.UpdatedControls.AddRange(new AjaxUpdatedControlsCollection()
{
new AjaxUpdatedControl(repSections.UniqueID,""),
new AjaxUpdatedControl(panelNosections.UniqueID,""),
new AjaxUpdatedControl(radNotification.UniqueID, "")
});
ajaxManagerProxy.AjaxSettings.Add(ajaxSetting_linkbtAddNormalSection);
...
}
Because of this, RadAjax places a RadAjaxPanel that includes all the created zones inside of the repeater causing the DockPositionChanged event to function in ajax mode. That's fine, and works great since avoids a regular postback each time a dock changes position.
The issue is that I need to show a RadNotification that is outside the repeater and consequently, outside that RadAjaxPanel and I can't show it from the DockPositionChanged event.
Any suggestion to overcome this?
Thank you!
<
telerik:RadNotification
ID
=
"RadNotification1"
runat
=
"server"
Position
=
"Center"
Width
=
"240"
Height
=
"100"
OnCallbackUpdate
=
"OnCallbackUpdate"
LoadContentOn
=
"PageLoad"
AutoCloseDelay
=
"60000"
Title
=
"Continue Your Session"
TitleIcon
=
""
Skin
=
"Office2007"
EnableRoundedCorners
=
"true"
ShowCloseButton
=
"false"
KeepOnMouseOver
=
"false"
>
<
ContentTemplate
>
<
div
class
=
"infoIcon"
>
<
img
src
=
"images/infoIcon.jpg"
alt
=
"info icon"
/>
</
div
>
<
div
class
=
"notificationContent"
>
Time remaining: <
span
id
=
"timeLbl"
>60</
span
>
<
telerik:RadButton
Skin
=
"Office2007"
ID
=
"continueSession"
runat
=
"server"
Text
=
"Continue Your Session"
Style
=
"margin-top: 10px;"
AutoPostBack
=
"false"
OnClientClicked
=
"ContinueSession"
>
</
telerik:RadButton
>
</
div
>
</
ContentTemplate
>
</
telerik:RadNotification
>
if
(!IsPostBack)
{
//set the expire timeout for the session
Session.Timeout = 2;
//configure the notification to automatically show 1 min before session expiration
RadNotification1.ShowInterval = (Session.Timeout - 1) * 60000;
//set the redirect url as a value for an easier and faster extraction in on the client
RadNotification1.Value = Page.ResolveClientUrl(
"default.aspx"
);
}
function
UpdateTimeLabel(toReset) {
var
sessionExpired = (seconds == 0);
if
(sessionExpired) {
//stopTimer("timeLeftCounter");
//redirect to session expired page - simply take the url which RadNotification sent from the server to the client as value
window.location.href = $find(
"<%= RadNotification1.ClientID %>"
).get_value();
}
else
{
var
timeLbl = $get(
"timeLbl"
);
timeLbl.innerHTML = seconds--;
}
}
function
ContinueSession() {
var
notification = $find(
"<%= RadNotification1.ClientID %>"
);
//we need to contact the server to restart the Session - the fastest way is via callback
//calling update() automatically performs the callback, no need for any additional code or control
notification.update();
notification.hide();
//resets the showInterval for the scenario where the Notification is not disposed (e.g. an AJAX request is made)
//You need to inject a call to the ContinueSession() function from the code behind in such a request
var
showIntervalStorage = notification.get_showInterval();
//store the original value
notification.set_showInterval(0);
//change the timer to avoid untimely showing, 0 disables automatic showing
notification.set_showInterval(showIntervalStorage);
//sets back the original interval which will start counting from its full value again
//stopTimer("timeLeftCounter");
//seconds = 60;
//updateMainLabel(true);
}
this is client side code:
<code>
function OnClientUpdated(sender, args) {
var message = "Update (check) was done!";
var newMsgs = sender.get_value();
if (newMsgs != 0) {
sender.show();
message += (newMsgs == 1) ? (" There is 1 new message!") : (" There are " + newMsgs + " new messages!");
}
else {
sender.hide();
}
console.log(message);
}
<telerik:RadNotification ID="ClientNotification" Visible="true" runat="server" RenderMode="Lightweight" EnableRoundedCorners="false" EnableShadow="true"
Width="100%" Height="90" VisibleOnPageLoad="false"
Animation="Slide" AnimationDuration="500" VisibleTitlebar="false" ShowTitleMenu="false" KeepOnMouseOver="true"
Position="BottomCenter" AutoCloseDelay="4000" LoadContentOn="TimeInterval" UpdateInterval="12000" Skin="Telerik"
OnClientUpdated="OnClientUpdated" OnClientUpdating="OnClientUpdating" OnCallbackUpdate="OnCallbackUpdateClient">
<%-- <NotificationMenu>
<Items>
<telerik:RadMenuItem Text="Classic" Value="Classic" />
<telerik:RadMenuItem Text="Business" Value="Business" />
</Items>
</NotificationMenu>--%>
<ContentTemplate>
<blockquote>
<asp:image ID="notifyIconClient" runat="server" /> <asp:Literal ID="WriteMsgClient" EnableViewState="false" runat="server" />
<br />
<asp:HyperLink ID="instantmsgLinkClient" EnableViewState="false" Text="Go to your TMN Members instant message page to view and respond to them now" runat="server" />
<br />
<br />
</blockquote>
</ContentTemplate>
</telerik:RadNotification>
</code>
this is server side code:
<code>
Protected Sub OnCallbackUpdateClient(sender As Object, e As RadNotificationEventArgs)
Dim getClientFirstName_Parameter As SqlParameter
Dim NotifyClientIMCount_Parameter As SqlParameter
Dim MyClientName As String = String.Empty
Dim MsgCntClient As Integer
Dim globalLog As LoginView = CType(Page.Master.FindControl("globalinmsge"), LoginView)
Dim ClientNotify As RadNotification = CType(globalLog.FindControl("ClientNotification"), RadNotification)
Using getClientFirstName_conn = New SqlConnection(ConnectionStrings("TMNall").ConnectionString)
Using getClientFirstName_cmd = New SqlCommand("dbo.getTMNClientFristName", getClientFirstName_conn)
getClientFirstName_cmd.CommandType = CommandType.StoredProcedure
getClientFirstName_cmd.CommandTimeout = 0
getClientFirstName_cmd.CommandText = "dbo.getTMNClientFristName"
getClientFirstName_Parameter = getClientFirstName_cmd.CreateParameter()
getClientFirstName_Parameter.ParameterName = "@username"
getClientFirstName_Parameter.Direction = ParameterDirection.Input
getClientFirstName_Parameter.SqlDbType = SqlDbType.NVarChar
getClientFirstName_Parameter.Value = "badboy69" 'Membership.GetUser(Page.User.Identity.Name).ToString()
getClientFirstName_cmd.Parameters.Add(getClientFirstName_Parameter)
getClientFirstName_conn.Open()
Using getClientFirstName_Reader = getClientFirstName_cmd.ExecuteReader()
If getClientFirstName_Reader.Read() Then
MyClientName = getClientFirstName_Reader("TMNmem_FirstName").ToString()
End If
End Using
End Using
End Using
Using NotifyClientIMCount_conn = New SqlConnection(ConnectionStrings("TMNall").ConnectionString)
Using NotifyClientIMCount_cmd = New SqlCommand("dbo.getClientNotifyIMmsgCnt", NotifyClientIMCount_conn)
NotifyClientIMCount_cmd.CommandType = CommandType.StoredProcedure
NotifyClientIMCount_cmd.CommandTimeout = 0
NotifyClientIMCount_cmd.CommandText = "dbo.getClientNotifyIMmsgCnt"
NotifyClientIMCount_Parameter = NotifyClientIMCount_cmd.CreateParameter()
NotifyClientIMCount_Parameter.ParameterName = "@username"
NotifyClientIMCount_Parameter.Direction = ParameterDirection.Input
NotifyClientIMCount_Parameter.SqlDbType = SqlDbType.NVarChar
NotifyClientIMCount_Parameter.Value = "badboy69" 'Membership.GetUser(Page.User.Identity.Name).ToString()
NotifyClientIMCount_cmd.Parameters.Add(NotifyClientIMCount_Parameter)
NotifyClientIMCount_conn.Open()
Using NotifyClientIMCount_Reader = NotifyClientIMCount_cmd.ExecuteReader()
If NotifyClientIMCount_Reader.Read() Then
If CInt(NotifyClientIMCount_Reader("NotifyIMClientCnt").ToString()) <> 0 Then
MsgCntClient = CInt(NotifyClientIMCount_Reader("NotifyIMClientCnt").ToString())
Else
MsgCntClient = 0
End If
End If
End Using
End Using
End Using
Dim clientmesg As Literal = CType(ClientNotify.ContentContainer.FindControl("WriteMsgClient"), Literal)
Dim linkclient As HyperLink = CType(ClientNotify.ContentContainer.FindControl("instantmsgLinkClient"), HyperLink)
Dim ClientImg As Image = CType(ClientNotify.ContentContainer.FindControl("notifyIconClient"), Image)
clientmesg.Text = [String].Concat(New Object() {MyClientName.ToString(), " you have ", MsgCntClient, " new instant message(s)!"})
linkclient.NavigateUrl = "~/Account/clientsMain"
ClientNotify.Value = MsgCntClient.ToString()
ClientImg.ImageUrl = "~/images/radlaerticon.jpg"
End Sub
</code>
thanks guys
<telerik
:RadButton
ID
=
"testButton"
runat
=
"server"
Text
=
"Click Me!"
OnClientClicking
=
"ValidateJScript();"
></
telerik:RadButton
>
<
telerik:radnotification
id
=
"notification"
runat
=
"server"
> </
telerik:radnotification
>
function
ValidateJScript() {
var
notification = $find(
'<%=RadNotification.ClientID %>'
);
var
message =
'Hello World'
;
notification.text = message;
alert(notification.text);
notification.show();
Dear Team,
We are using ShowSound property and it doesn't work in mobiles and tablets. However it is working fine in desktop browsers. I have already tried below code which i got from your website but still no difference.
<script type="text/javascript">function pageLoad() {//Attach to the document touchstart event and initiate the notification audio $telerik.$(document).on("touchstart", initSound);}function initSound() {var notification = $find("<%=RadNotification1.ClientID%>");//If notification audio is not available initiate itif (!notification.verifySound()) { notification.userInitSound();}//Detach the initSound event listener $telerik.$(document).off("touchstart", initSound);}</script><telerik:RadNotification RenderMode="Lightweight" ID="RadNotification1" runat="server" ShowInterval="2000" AutoCloseDelay="1000" Text="Some Notification" ShowSound="warning"></telerik:RadNotification>
I have also tried in code behind but result is same.
RadNotification1.ShowSound = ResolveUrl("~/Images/OrderReceived.wav");
Kindly let me know how we can enable sound on mobile/tablet devices.
Thanks & Regards,
Jatin Kumar Verma
<
telerik:RadNotification
ID
=
"Notification"
runat
=
"server"
Position
=
"Center"
AutoCloseDelay
=
"10000"
Width
=
"350"
EnableRoundedCorners
=
"true"
ContentIcon
=
"none"
KeepOnMouseOver
=
"true"
ShowCloseButton
=
"false"
>
<
ContentTemplate
>
<
asp:Literal
ID
=
"NotificationText"
runat
=
"server"
/>
</
ContentTemplate
>
</
telerik:RadNotification
>
protected
void
SaveQuoteButton_Click(
object
sender, EventArgs e)
{
Notification.Title =
"Save Title"
;
NotificationText.Text =
"Save Text"
;
Notification.Show();
}