Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Textbox chinese characters entry becomes English chars after timer refresh

$
0
0

Hi there,

We have an asp.net 2.0 ajax page, with a timer refreshing a few GridViews. There is also a TextBox which at the end of the timer activity will set focus on it.

    <form id="form1" runat="server">

    <asp:ScriptManager ID="sm" runat="server" />    
        
    <asp:Timer ID="Timer1" runat="server" Interval="10000" ontick="Timer1_Tick" 
        Enabled="true" />    

    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
        <ContentTemplate>	
	    <asp:TextBox ID="tbInfo" runat="server" Width="150"></asp:TextBox> 	                                                        
            <asp:GridView ID="gv1" .... />
            <asp:GridView ID="gv2" .... />        
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
        </Triggers>      
    </asp:UpdatePanel>
           
    <br />        
    
    <asp:UpdatePanel ID="upMsg" runat="server" UpdateMode="Conditional">
        <ContentTemplate>			                                                        
            <asp:TextBox ID="tbMsg" runat="server" Rows="6" TextMode="MultiLine" 
                Width="329px" />
        </ContentTemplate>
        <Triggers>
        </Triggers>      
    </asp:UpdatePanel>
            
    </form>

Code behind:
    protected void Timer1_Tick(object sender, EventArgs e)
    {
        // Refresh gridviews....

        tbInfo.Text = DateTime.Now.ToString("dd MMM yyyy hh:mm:ss");
        tbInfo.BackColor = System.Drawing.Color.LightGreen;

        tbMsg.Focus();
    }


When entering English characters everything is ok. However, when entering Chinese characters, after timer refresh the Chinese entry becomes English entry. Only when switching to another TextBox and back to the original then it is ok. Removing the tbMsg.Focus(); at the end of Timer_Tick will not have this issue. But I need to ensure that the foucs is set on the typing textbox after the timer has updated other controls.

Has anyone encountered this before? Please help .........................

Thanks,

Ben


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>