Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
768 views

Dear Telerik Team,

We would like to use rad notification session timeout feature in my code but we have different project scenario.
We have master page in project but Form tag is inside content page so we are not able to add notification control in master page.
We don't want to add rad notification on each page.
We have created a dynamic control on page load but getting error on continue session button.

Master Page ASPX
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="SampleApplicationSession.Site1" %>

<!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 runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
     <div class="clockSession">
            <div class="contSession">
                <div class="sesseionExpire">
                    Your Session will expire in minutes</div>
                <div class="showNotification">
                    Notification will be shown in:</div>
                <div class="timeRemain">
                    <span class="timeSeconds"><span id="mainLbl">60 </span></span>seconds</div>
            </div>
        </div>
    <div>
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
        
        </asp:ContentPlaceHolder>
    </div>
</body>
</html>

Master page CS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SampleApplicationSession
{
    public partial class Site1 : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}
WebForm1.CS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SampleApplicationSession
{
    public partial class WebForm1 :BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["Userid"] = "Test";

        }
    }
}

WebForm ASPX

<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="SampleApplicationSession.WebForm1" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>




<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">


   

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
 
<form id="GlmasterViewForm" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    <Scripts>
        <asp:ScriptReference Assembly="Telerik.Web.UI" 
            Name="Telerik.Web.UI.Common.Core.js">
        </asp:ScriptReference>
        <asp:ScriptReference Assembly="Telerik.Web.UI" 
            Name="Telerik.Web.UI.Common.jQuery.js">
        </asp:ScriptReference>
        <asp:ScriptReference Assembly="Telerik.Web.UI" 
            Name="Telerik.Web.UI.Common.jQueryInclude.js">
        </asp:ScriptReference>
    </Scripts>
</telerik:RadScriptManager>
</form>

</asp:Content>


BaseFile
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Telerik.Web.UI;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;


namespace SampleApplicationSession
{
    public class BasePage : System.Web.UI.Page
    {

        RadNotification SessionTimeOutNotification = new RadNotification();

        protected void OnCallbackUpdate(object sender, RadNotificationEventArgs e)
        {

        }
        protected override void OnLoad(EventArgs e)
        {
            try
            {

                if (!Page.IsPostBack)
                {
      



                    SessionTimeOutNotification.ContentContainer.CssClass = "";
                    SessionTimeOutNotification.ID = "TestRad";
                    SessionTimeOutNotification.RenderMode = RenderMode.Lightweight;
                    //SessionTimeOutNotification.Position = NotificationPosition.TopCenter;
                    //rad.Width = 190;
                    SessionTimeOutNotification.Title = "Continue Your Session";
                    SessionTimeOutNotification.EnableRoundedCorners = true;
                    SessionTimeOutNotification.ShowCloseButton = false;
                    SessionTimeOutNotification.KeepOnMouseOver = false;
                    SessionTimeOutNotification.LoadContentOn = NotificationLoad.PageLoad;
                    //SessionTimeOutNotification.AutoCloseDelay = 6000;
                    
                   
                    //configure the notification to automatically show 1 min before session expiration
                    SessionTimeOutNotification.ShowInterval = (Session.Timeout - (Session.Timeout - 1)) * 60 * 1000;
                    SessionTimeOutNotification.AutoCloseDelay = 60000;

                    //set the redirect url as a value for an easier and faster extraction in on the client
                    SessionTimeOutNotification.Value = Page.ResolveClientUrl("SessionExpired.aspx");
                    MyTemplate1 objTemplate = new MyTemplate1();
                    SessionTimeOutNotification.ContentTemplate = objTemplate;
                    SessionTimeOutNotification.OnClientShowing = "notification_showing";
                    SessionTimeOutNotification.OnClientHidden = "notification_hidden";

                    SessionTimeOutNotification.CallbackUpdate += OnCallbackUpdate;

                    //SessionTimeOutNotification.CallbackUpdate += new EventHandler(OnCallbackUpdate);

                    this.Form.Controls.Add(SessionTimeOutNotification);

                    if (!ClientScript.IsStartupScriptRegistered("key1"))
                    {
                        ClientScript.RegisterStartupScript(GetType(), "key1", @"<script type=""text/javascript"" src=""../Resources/js/SessionExpired.js""></script>");
                    }

                    if (!ClientScript.IsStartupScriptRegistered("SessionControlScript"))
                    {
                        String cstext1 = "<script type=\"text/javascript\">" +
                        "serverIDs({ notificationID: 'ctl00_ContentPlaceHolder1_TestRad' });</" + "script>";
                        
                        ClientScript.RegisterStartupScript(GetType(), "SessionControlScript", cstext1);
                    }


                }
            }
            catch(Exception ex )
            {}


    
        }

        /// <summary>
        /// This is the base class for the web pages.
        /// We need to implement the common functionalities in this 
        /// class going forward.
        /// </summary>
        public class MyTemplate1 : ITemplate
        {
            protected RadButton btnMsg;
            string colnames;
            public MyTemplate1()
            {

            }
            public void InstantiateIn(System.Web.UI.Control container)
            {


                btnMsg = new RadButton();
                btnMsg.ID = "btnMsg";
                btnMsg.Text = "Continue Your Session";
                btnMsg.OnClientClicked = "ContinueSession";
                btnMsg.AutoPostBack = false;

                //boolValue.DataBinding += new EventHandler(boolValue_DataBinding);
                // boolValue.Enabled = false;
                HtmlGenericControl DivinfoIcon = new HtmlGenericControl("DIV");
                DivinfoIcon.Attributes.Add("class", "infoIcon");
                HtmlGenericControl DivinotificationContent = new HtmlGenericControl("DIV");
                DivinotificationContent.Attributes.Add("class", "notificationContent");
                HtmlGenericControl Div1 = new HtmlGenericControl("DIV");
                Label lblText = new Label();
                lblText.Text = "Time remaining: ";
                lblText.ID = "lblTime";
                HtmlGenericControl tiemlbl = new HtmlGenericControl("SPAN");
                tiemlbl.ID = "timeLbl";
                tiemlbl.InnerHtml = "60";
                tiemlbl.Attributes.Add("class", "timeLbl");
                Div1.Controls.AddAt(0, lblText);
                Div1.Controls.AddAt(1, tiemlbl);
                DivinotificationContent.Controls.AddAt(0, Div1);
                DivinotificationContent.Controls.AddAt(1, btnMsg);
                DivinfoIcon.Controls.Add(DivinotificationContent);
                container.Controls.Add(DivinfoIcon);
            }
        }

    }
}


i am getting attached error on this. Is there any better way to implement it ?

 

Please suggest is there is any better way to implement it.

Marin Bratanov
Telerik team
 answered on 02 May 2017
1 answer
110 views

Hello, I have just upgraded to the latest Telerik version and am trying to make my pager template responsive by having the page numbers hide via the trim class.  I've added the TrimMd="true" to my button field control, and the class showing up in Developer Tools, but the WebResource file does not seem to have the latest CSS, it does not include the trim classes.  

Is there something else I need to add to the control to have it recognize the responsive classes?  I'm confident the DLLs updated properly, as my Telerik Editor is working on mobile.

Thanks for any help!

<telerik:RadDataPagerButtonField FieldType="NextLast" HorizontalPosition="RightFloat" />
  <telerik:RadDataPagerButtonField FieldType="Numeric" TrimMd="true" HorizontalPosition="RightFloat" />
<telerik:RadDataPagerButtonField FieldType="FirstPrev" HorizontalPosition="RightFloat" />

 

Rumen
Telerik team
 answered on 02 May 2017
1 answer
144 views

Hello, I have just upgraded to the latest Telerik version and am trying to make my datapager responsive by having the page numbers hide via the trim class.  I've added the TrimMd="true" to my button field control, and the class showing up in Developer Tools, but the WebResource file does not seem to have the latest CSS, it does not include the trim classes.  

 

Is there something else I need to add to the control to have it recognize the responsive classes?  I'm confident the DLLs updated properly, as my Telerik Editor is working on mobile.

 

Thanks for any help!

 

 

<CCWeb:TelerikPager runat="server" Skin="Bootstrap"  RenderMode="Lightweight"   >
    <Fields>
     
     <telerik:RadDataPagerButtonField FieldType="NextLast" HorizontalPosition="RightFloat" />
      <telerik:RadDataPagerButtonField FieldType="Numeric" TrimMd="true" HorizontalPosition="RightFloat" />
    <telerik:RadDataPagerButtonField FieldType="FirstPrev" HorizontalPosition="RightFloat" />
     
    </Fields>        
</CCWeb:TelerikPager>

 

Rumen
Telerik team
 answered on 02 May 2017
1 answer
142 views

Hello,

I am looking to use RadSpreadsheet to import a spreadsheet template and then override/replace some of the values with database data. Is there a way to do this? I can't find anything in your documentation regarding using multiple providers with this product. Thanks for your help!

Vessy
Telerik team
 answered on 02 May 2017
3 answers
747 views

Hi,

I have a page with a couple of RadWindows.

The statement $find("<%=rwPrototypeSummary.ClientID%>") returns null, while similar statement for other RadWindows works fine.

Not sure what am I missing.

The markup is as follows:

<telerik:RadWindowManager ID="Singleton" runat="server" Animation="None" Behaviors="Move"
        Width="900px">
        <windows>
            <telerik:RadWindow ID="rwProtoResponseMediaEdit" Behaviors="Move, Resize, Maximize" Skin="Telerik"
                VisibleStatusbar="false" ReloadOnShow="false" OnClientClose="rwProtoResponseMediaEdit_ClientClose"
                BorderWidth="0" Width="950px" Modal="true" runat="server" Height="530px" Title="Prototype Media"
                NavigateUrl="~/Agency/Authoring/ProtoResponseMediaEdit.aspx">
            </telerik:RadWindow>
            <telerik:RadWindow ID="rwResource" runat="server" Title="Pick a Resource" VisibleStatusbar="false"
                Modal="true" NavigateUrl="~/Agency/Search/ResourceSearch.aspx"
                Width="800" Height="650">
            </telerik:RadWindow>
            <telerik:RadWindow ID="rwPatientProfileEdit" Behaviors="Move, Resize, Maximize" Skin="Telerik"
                VisibleStatusbar="false" ReloadOnShow="false" OnClientClose="rwPatientProfileEdit_ClientClose"
                BorderWidth="0" Width="950px" Modal="true" runat="server" Height="530px" Title="Prototype Patient"
                NavigateUrl="~/Agency/Authoring/PatientProfileEditEdit.aspx">
            </telerik:RadWindow>
            <telerik:RadWindow ID="rwPrototypeMediaEdit" Behaviors="Move, Resize, Maximize" Skin="Telerik"
                VisibleStatusbar="false" ReloadOnShow="false" OnClientClose="rwPrototypeMediaEdit_ClientClose"
                BorderWidth="0" Width="950px" Modal="true" runat="server" Height="530px" Title="Prototype Media"
                NavigateUrl="~/Agency/Authoring/PrototypeMediaEdit.aspx">
            </telerik:RadWindow>
            <telerik:RadWindow ID="rwPrototypeSummary" Behaviors="Move, Resize, Maximize" Skin="Telerik"
                VisibleStatusbar="false" ReloadOnShow="false" OnClientClose="rwPrototypeSummary_ClientClose"
                BorderWidth="0" Width="950px" Modal="true" runat="server" Height="530px" Title="Prototype Summary"
                NavigateUrl="~/Agency/Authoring/PrototypeSummary.aspx">
            </telerik:RadWindow>
        </windows>
    </telerik:RadWindowManager>

 

The Javascript is as follows:

<telerik:RadScriptBlock runat="server" ID="RadScriptBlock1">

        <script type="text/javascript">

     function OpenPrototypeSummary(pid) {
                var url = '<%= ConvertRelativeUrlToAbsoluteUrl("~/Agency/Authoring/PrototypeSummary.aspx") %>';
                url = url + "?id=" + pid;

                console.log(url);

                var oWnd = $find("<%=rwPrototypeSummary.ClientID%>");

                console.log(oWnd);

                oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Resize + Telerik.Web.UI.WindowBehaviors.Maximize);
                //oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Resize + Telerik.Web.UI.WindowBehaviors.Maximize);
                oWnd.show();
                oWnd.setSize(950, 850);
                oWnd.setUrl(url);
                oWnd.minimize();
                oWnd.maximize();
                oWnd.restore();
                oWnd.center();
            }

            function rwPrototypeSummary_ClientClose(sender, args) {

                var arg1 = args.get_argument();

            }
        </script>

    </telerik:RadScriptBlock>

ozgur
Top achievements
Rank 1
 answered on 02 May 2017
2 answers
216 views

Hi, we've just updated from 2017.1.118 to 2017.1.228 and noticed a dramatic change in the way the RadButton control is rendered. Specifically, the checkbox state of the RadButton doesn't seem to display at all except when using the Default skin and even then it doesn't display properly. When trying to use the Silk skin for example, the Chrome console errors with a WebResource.axd 404 error. We've gone through the Web Resources Troubleshooting and haven't been able to resolve the issue. It seems odd as we've updated in the past with no issues. The normal RadButton displays fine.

 

Thanks

Daniel

Vessy
Telerik team
 answered on 02 May 2017
3 answers
191 views

Hello, I've just upgraded to the latest Telerik DLLs and am working on making the Editor responsive.  I'm not a fan of the mobile mode, which doesn't seem to work too well on either Android or Iphone, so I would prefer to use the Lightweight rendering.

 

I have an existing Toolbar.xml that I've been using.  Is it possible to hide some of the buttons as the window resizes, either by applying bootstrap classes or via media queries in the CSS?  In addition, is there a property for hiding the Design/HTML view upon resizing as well?

 

Thank you for any direction on this!

 

Rumen
Telerik team
 answered on 02 May 2017
1 answer
144 views

Hello,

we are building custom version of Metro skin for our application from source codes. But in version "Telerik_UI_for_ASP.NET_AJAX_2017_1_228_Source" there is something strange. Many missing variables in scss files with commented styles and infos as "// TODO: missing color" etc. skin source codes references scss files to design project and many more.

Does it men this source code is not RTM and is it some debug build? Or how to get final source codes?

 

Regards

René

René
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 02 May 2017
6 answers
692 views
Greetings,

I have an ASP.Net Framework 4 application on Windows 7, using C# for the backend coding, that I need to be able to trigger off of a paste event in a RadTextBox control.

Scenario is there are two text box controls. If the user enters text into one text box, the other text box needs to be cleared. I have handled this for the case when the user types new text into either of the text boxes, but that solution (using the ClientEvents-OnKeyPress event handler) does not work for a paste operation.

Is there a solution to this that I have not found? If so, any assistance would be appreciated.

Thanks.

Steve

Specifics:
- ASP.Net Framework 4
- Windows 7 SP 1
- IE 9.0.8112.16421
- Telerik WebUI VSExtensions 2011.02.712.0
- Preferred Programing Language: C#
Vasssek
Top achievements
Rank 1
 answered on 02 May 2017
1 answer
196 views

I'm struggling with trying to get to the SearchContext item for a radsearchbox via the client side.  below I have what I'm trying to get to, but to no avail. If some guidance could be provided I would greatly appreciate it.

 

 

function onCheckboxChanging(sender, args) {
    var chkbxlId = sender.get_id();
    var srchbxId = chkbxlId.replaceAll("radchkbox_Item", "radsearch_Item");
 
    var objSearchBox = $find(srchbxId);
    var objSearchContext = objSearchBox.get_searchContext();
 
    alert( 'SearchBox Context Item Value = ' + objSearchContext.value);
 
 
}
Vessy
Telerik team
 answered on 02 May 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?