Ajax: updatepanel / timer takes focus from my dropdownlist
I use a timer and updatepanel to show clock in my page. using this codes in my aspx:
<%@ Control language="C#" Inherits="Mosi.Modules.Clock.ViewClock" CodeFile="ViewClock.ascx.cs" AutoEventWireup="true"%>
<asp:Timer ID="Tmrclk" runat="server" Interval="1000" ontick="Tmrclk_Tick">
</asp:Timer>
<asp:UpdatePanel ID="Updpanelclk" runat="server" ChildrenAsTriggers="False"
UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Tmrclk" EventName="Tick">
</asp:AsyncPostBackTrigger>
</Triggers>
<ContentTemplate>
<a开发者_JS百科sp:Label ID="lblclk" runat="server"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
and this code in my aspx.cs file:
protected void Tmrclk_Tick(object sender, EventArgs e)
{
lblclk.Text = DateTime.Now.ToLongTimeString();
}
I use this code as a module in dotnetnuke CMS and it works! but when in dotnetnuke I choose a control panel dropdownlist this ajax code cause the dropdownlist unfocused and close.
how can I maintain focus on this dropdownlist.
any help would be appreciated. Thanks
Why not use Javascript to show and update your time instead of ajax. I think this would be a better option for your module. Then you dont have to worry about ajax at all. Please see this link below for an example.
Display Date and Time in Javascript
加载中,请稍侯......
精彩评论