or
RadTabStrip1.SelectedTab.PageView.Controls[0].FindControl("RadGrid1")| <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm4.aspx.cs" Inherits="Darman.WebForm4" %> |
| <!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> |
| <script src="../JQuery/jquery-1.4.1.js" language="javascript" type="text/javascript"></script> |
| <script type="text/javascript"> |
| $(function() { |
| $('input[id$=RadComboBox1_Input]').focus(); |
| $('input[id$=RadComboBox1_Input]').select(); |
| $('input[id$=RadComboBox1_Input]').bind('keyup', function(e) { |
| var code = (e.keyCode ? e.keyCode : e.which); |
| if (code == 13) { |
| $('input[id$=RadComboBox1_Input]').blur(); |
| $('input[id$=RadComboBox2_Input').focus(); |
| $('input[id$=RadComboBox2_Input]').select(); |
| } |
| }); |
| $('input[id$=RadComboBox2_Input]').bind('keyup', function(e) { |
| var code = (e.keyCode ? e.keyCode : e.which); |
| if (code == 38) { |
| $('input[id$=RadComboBox2_Input]').blur(); |
| $('input[id$=RadComboBox1_Input').focus(); |
| $('input[id$=RadComboBox1_Input]').select(); |
| } |
| }); |
| }); |
| </script> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
| </telerik:RadScriptManager> |
| <div> |
| <telerik:RadComboBox ID="RadComboBox1" runat="server" Skin="Outlook"> |
| <Items> |
| <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1" |
| Value="RadComboBoxItem1" /> |
| <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2" |
| Value="RadComboBoxItem2" /> |
| <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem3" |
| Value="RadComboBoxItem3" /> |
| <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem4" |
| Value="RadComboBoxItem4" /> |
| </Items> |
| </telerik:RadComboBox> |
| <telerik:RadComboBox ID="RadComboBox2" runat="server" Skin="Office2007"> |
| <Items> |
| <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1" |
| Value="RadComboBoxItem1" /> |
| <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2" |
| Value="RadComboBoxItem2" /> |
| <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem3" |
| Value="RadComboBoxItem3" /> |
| <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem4" |
| Value="RadComboBoxItem4" /> |
| </Items> |
| </telerik:RadComboBox> |
| </div> |
| </form> |
| </body> |
| </html> |
Folks, Environment VS 2010 with RadControls for ASP.NET AJAX Q2 2011 SP1. I am using below Telerik Demo for Session Time out.
http://demos.telerik.com/aspnet-ajax/notification/examples/sessiontimeout/defaultcs.aspx
This above approach is based on preset timeout value within the .aspx page. But I would prefer to show the Session timout inactivity alert based in value set in my Web Config file (here is 20 minutes).
My webconfig file...<system.web>.......<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20" />
.......</system.web>If possible, will very much appreciate if any sample code is provided for this solution. Thanks a lot.
GC_0620


<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Engage20.ascx.cs" Inherits="edu.yale.som.engage.Engage20" %><%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %><style type="text/css"> .rootNode { font-size: 13px; font-weight: bold; } div[class='rtTop rtSelected'] div.rtIn, div[class='rtMid rtSelected'] div.rtIn, div[class='rtBot rtSelected'] div.rtIn { color: black !important; background-color: transparent !important; background-image: none !important; border-color: transparent !important; } </style><script type="text/javascript"> function TreeView_OnClientLoad() { var $ = $telerik.$; $(".rtTemplate").bind("keydown", function (e) { if (e.keyCode == 32) e.stopPropagation(); }); } function OnClientNodeChecked(sender, eventArgs) { var node = eventArgs.get_node(); if (node.get_allowEdit() && node.get_checked()) { node.select(); }}</script><table border="0" width="100%"><tr><td><telerik:RadTreeView ID="EngageTree" runat="server" CheckBoxes="true" DataFieldID="TagID" DataFieldParentID="ParentID" DataTextField="Name" DataSourceID="TagDataSource" Skin="Vista" OnNodeCheck="OnNodeChecked" DataValueField="TagID" EnableViewState="true" OnClientLoad="TreeView_OnClientLoad" OnClientNodeChecked="OnClientNodeChecked"> <DataBindings> <telerik:RadTreeNodeBinding Depth="0" CheckableField="Checkable" TextField="Name" Expanded="False" CssClass="rootNode" CheckedField="Checked" AllowEditField="IncludeTextBox" CategoryField="UserResponse"/> <telerik:RadTreeNodeBinding CheckedField="Checked" AllowEditField="IncludeTextBox" CheckableField="Checkable" CategoryField="UserResponse"/> </DataBindings> <NodeTemplate> <%# DataBinder.Eval(Container, "Text") %> <asp:TextBox Text='<%# DataBinder.Eval(Container, "Category") %>' ToolTip='<%# DataBinder.Eval(Container, "Value") %>' runat="server" Visible='<%# DataBinder.Eval(Container, "AllowEdit").ToString() == "True" %>' AutoPostBack="true" OnTextChanged="textBox_OnTextChanged" /> </NodeTemplate></telerik:RadTreeView></td><td> <asp:Panel ID="EngageTextResponses" runat="server"> </asp:Panel></td></tr></table><asp:SqlDataSource ID="TagDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:edu_yale_som_engage_connectionString %>" SelectCommand="SELECT Tags.TagID, Tags.ParentID, Tags.Name, Tags.Description, Tags.Checkable, Tags.IncludeTextBox, Tags.TypeID, Tags.AssociatedAction, Tags.Position, UserTags.PersonID, UserTags.UserResponse, Tags.IncludeTextBox, CASE When PersonID IS NULL Then 'false' Else 'true' END As Checked FROM Tags LEFT OUTER JOIN (SELECT RecordID, TagID, PersonID, DateStamp, UserResponse FROM UserTags AS UserTags_1 WHERE (PersonID = @PersonID)) AS UserTags ON Tags.TagID = UserTags.TagID WHERE (Tags.TypeID = @TypeID) Order By Position ASC, Tags.Name ASC"> <SelectParameters> <asp:ControlParameter ControlID="HiddenFieldPersonID" PropertyName="Value" Name="PersonID" /> <asp:ControlParameter ControlID="HiddenFieldTypeID" PropertyName="Value" Name="TypeID" /> </SelectParameters> </asp:SqlDataSource> <asp:HiddenField ID="HiddenFieldPersonID" runat="server" /> <asp:HiddenField ID="HiddenFieldTypeID" runat="server" />using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Configuration;using System.Data.SqlClient;namespace edu.yale.som.engage{ public partial class Engage20 : System.Web.UI.UserControl { public edu.yale.som.sitefinity.shared.Common commonCode = null; private String connectionStringName = null; SqlConnection dbConn = null; public int personID; private String _TagTypeID = null; public string TagTypeID { get { return ViewState["_TagTypeID"] as String; } set { try { //check if page is being accessed in the admin if (commonCode.IsPageInAdmin(this)) { //check if the users is an admin if (!Page.User.IsInRole("Admins")) { throw new Exception("Unauthorized access attempt!"); } } ViewState["_TagTypeID"] = value; } catch (Exception e) { throw new Exception("Error in edu.yale.som.engage.Engage20.SetTagTypeID()" + e.Message); } } } protected void Page_Load(object sender, EventArgs e) { //check to see if property is set. if (TagTypeID == null || TagTypeID == string.Empty || TagTypeID == "") { throw new Exception("Tag Type not set"); } try { // Retrieve the Person ID for the current user personID = commonCode.getPersonID(commonCode.RealmNameStripper(Page.User.Identity.Name, HttpContext.Current), commonCode.getSessionAuthenticationImplementationID(HttpContext.Current)); //set PersonID and TagTypeID values into the front end controls for the DataSource to use. HiddenFieldPersonID.Value = personID.ToString(); HiddenFieldTypeID.Value = TagTypeID; } catch (Exception ex) { throw new Exception("Error in edu.yale.som.engage.Engage20.Page_Load(): " + ex.Message); } } public Engage20() { try { // Initalize the common object commonCode = new edu.yale.som.sitefinity.shared.Common(); // Initialize the connection string name for connecting to Engage if (ConfigurationManager.ConnectionStrings["edu_yale_som_engage_connectionString"] == null || ConfigurationManager.ConnectionStrings["edu_yale_som_engage_connectionString"].ToString() == string.Empty) { throw new Exception("Invalid database connection string."); } connectionStringName = ConfigurationManager.ConnectionStrings["edu_yale_som_engage_connectionString"].ToString(); } catch (Exception ex) { throw new Exception("Error in edu.yale.som.engage.Engage20 constructor: " + ex.Message); } } protected void OnNodeChecked(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e) { dbConn = new SqlConnection(connectionStringName); if (e.Node.Checked) { try { // Open the database connection dbConn.Open(); string t = e.Node.Value.ToString(); string InsQuery = "IF NOT EXISTS (SELECT * FROM UserTags WHERE tagID = " + @t + " AND personID = " + @personID + ") INSERT into UserTags(TagID, PersonID) VALUES(" + @t + "," + @personID + ")"; SqlCommand dbCmd = new SqlCommand(InsQuery, dbConn); dbCmd.ExecuteNonQuery(); } catch (Exception ex) { throw new Exception("Error Inserting User Tags edu.yale.som.engage.Engage20.OnNodeChecked() '" + ex.Message); } finally { if (dbConn != null) { dbConn.Close(); } } } else { try { // Open the database connection dbConn.Open(); string t = e.Node.Value.ToString(); string Query = "DELETE FROM UserTags WHERE tagID = " + @t + " AND personID = " + @personID; SqlCommand dbCmd = new SqlCommand(Query, dbConn); dbCmd.ExecuteNonQuery(); /* if (e.Node.AllowEdit){ EngageTree.DataBind(); } */ } catch (Exception ex) { throw new Exception("Error Deleting User Tags edu.yale.som.engage.Engage20.textBox_OnTextChanged() '" + ex.Message); } finally { if (dbConn != null) { dbConn.Close(); } } } } protected void textBox_OnTextChanged(object sender, EventArgs e) { TextBox box = (TextBox)sender; string InsQuery = null; string t = string.Empty; try { // Open the database connection dbConn = new SqlConnection(connectionStringName); dbConn.Open(); t = box.ToolTip.ToString(); InsQuery = "IF EXISTS (SELECT * FROM UserTags WHERE tagID = " + @t + " AND personID =" + @personID + ") UPDATE UserTags SET UserResponse = '" + box.Text + "' WHERE tagID = " + @t + " AND personID =" + @personID + " ELSE INSERT into UserTags(TagID, PersonID, UserResponse) VALUES(" + @t + "," + @personID + ",'" + box.Text + "' )"; SqlCommand dbCmd = new SqlCommand(InsQuery, dbConn); dbCmd.ExecuteNonQuery(); } catch (Exception ex) { throw new Exception("Error Inserting User Tags edu.yale.som.engage.Engage20.OnTextChanged() " + ex.Message); } finally { if (dbConn != null) { dbConn.Close(); } } } }}