Skip to main content

Posts

Showing posts from May, 2008

Postback the updatepanel when an item is selected in AutoCompleteExtender

<asp:TextBox ID="txtOrderNumber" runat="server" AutoCompleteType="Disabled" MaxLength="5"></asp:TextBox> <ajaxToolkit:AutoCompleteExtender ID="OrderNumberAutoCompleteExtender" runat="server" CompletionInterval="100" CompletionSetCount="20" ContextKey="region" EnableCaching="true" MinimumPrefixLength="2" ServiceMethod="GetOrderNumberList" ServicePath ="~/ASPX/Common/AutoComplete.asmx" TargetControlID="txtOrderNumber" UseContextKey="true" OnClientItemSelected="OrderNumberChanged" />

How to use ASP.net AJAX timer control to alert user when session times out.

Recently I needed a way to redirect the user to the login page after a certain time of inactivity. I found a neat way to do this using ASP.net AJAX timer control. Following is the approach I took. I put the code in my master page as it can be shared by all the content pages. 1) Drag and drop the script manager control. 2) Drag and drop an update panel. 3) Set the updatepanel's UpdateMode property to Conditional . 4) Drag and drop a Timer control inside the update panel. Set the Interval property to the session time out time. 5) Set the timer control as a trigger to the update panel which causes it to postback on some event (Tick) . Following is the code after the first 5 steps. <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanelMaster" UpdateMode="Conditional" runat="server"> <ContentTemplate> <asp:T