Skip to main content

Posts

Showing posts with the label AJAX

AutoComplete Extender dropping leading zeroes from the values in the result set

The autocomplete extender in the AJAX Control Toolkit drops off the leading zeroes from the values in the returned result set. This appears to be a known bug in the Autocomplete Extender. To rectify this problem, add single quotes to the value before adding it to the list either in your Web Method or Page Method that the AutoComplete Extender uses to load the results In your web method or page method do the following. resultList.Add("'"+result+"'"); //Single quotes are need as a work around for a known bug in autocomplete extender. Leading zeroes are dropped without quotes.

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...