Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi

my webpage heirarchy is

page -> updatepanel1 -> user_control1
page -> textbox1

user_control1 hierarchy
user_control1 -> table1 -> row1 -> cell1 -> updatepanel2 -> label(acting as count down timer)

user_control1 -> table1 -> row1 -> cell2 -> textbox2


PROBLEM:

I want to enter text in textbox2 but for every second when the timer changes the textbox2 is loosing its focus and i need to click manually every second and should type a letter within a second.

help me fixing this problem.
Posted

if u dont need to refresh the whole page(just content inside the update panel only) try AsyncPostbackTrigger

otherwise
add this in page load

TextBox2.Focus();
 
Share this answer
 
Comments
sunilkumarsistla 16-Aug-12 2:49am    
i have actually tried async postbacks and also focus
nothing happenned with async trigger
and when i used focus the timer stopped working.
can u please post the aspx page content...
 
Share this answer
 
Comments
sunilkumarsistla 16-Aug-12 16:24pm    
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="hangman_ctrl.ascx.cs" Inherits="hangman_ctrl" %>

<style type="text/css">

.style_Center_Allign
{
vertical-align : middle;
text-align: center;
text-transform :uppercase;
}

.style_Table
{
width: 275px;
height: 150px;
}

.style_Label_PartialWord
{
width : 300px;
height: 30px;
font-size:x-large;
background-color: #EEEEEE;
letter-spacing: 3px;
text-align : center;
padding-top: 5px;
text-transform :uppercase;
vertical-align:super;
}

.style_Level_Table_Show
{
width: 50px;
height: 120px;
}
.style_Level_Show_EachLevel
{
width: 50px;
height: 20px;
}

.style_Clock_Lifes_Table
{
height:120px;
width: 115px;
vertical-align : middle;
text-align: center;
}
.style_Clock_Text
{
height: 27px;
width: 115px;
vertical-align : middle;
text-align: center;
}
.style_Clock_Cell
{
height: 45px;
width: 115px;
vertical-align : middle;
text-align: center;
}

.style_Lifes_Text
{
height:25px;
width: 115px;
vertical-align : middle;
text-align: center;
}
.style_Lifes_Table
{
height: 23px;
width: 115px;
vertical-align : middle;
text-align: center;
}
.style_Lifes_Cell
{
height:23px;
width: 23px;
vertical-align : middle;
text-align: center;
}


.style_Letter_Buttons_Table
{
width: 110px;
height: 120px;
background-color: #FFFFFF;
}

.style_Letter_Text
{
width: 110px;
height: 30px;
vertical-align: middle;
text-align: center;
}
.style_Letter_Cell
{
width: 110px;
height: 35px;
vertical-align: middle;
text-align: center;
}
.style_Missed_Letters_Cell
{
width: 110px;
height: 30px;
vertical-align: middle;
text-align: center;
}

.style_Button_Table
{
width: 55px;
height: 25px;
vertical-align:middle;
text-align:center;
}
.style_Button_cell
{
width: 55px;
height: 25px;
vertical-align:middle;
text-align:center;
}


</style>

<div>
<asp:ScriptManager ID="scrpt_Manager" runat="server">


<asp:Timer ID="timer_Counter" runat="server" Interval = "1000"
ontick="timer_Counter_Tick">


<table cellpadding="0" cellspacing="0" class="style_Table">

<!-- defining a region for partial detected word -->
<tr id="Partial_word">
<td class="style_Label_PartialWord" colspan="3">
<div class = "style_Label">
<asp:Label ID="lbl_PartialWord" runat="server" Text="Label">
</div>
</td>
</tr>

<!-- defining a row for levels, <timers, lifes="">, <letter, buttons=""> -->
<tr id = "Levels_Timer_Lifes_Letter_Buttons">

<!-- defining a region for level status -->
<td id = "column_levels" class = "style_Level_Table_Show">
<div class = "style_Level_Table_Show">

<table cellpadding="0" cellspacing="0" class="style_Level_Table_Show">
<tr class = "style_Level_Show_EachLevel">
<td id = "cell_level_text" class = "style_Center_Allign">
<div>Level</div>
</td>
</tr>
<tr class = "style_Level_Show_EachLevel">
in your code where is upadate panel, async trigger...

any how plese remove
ontick="timer_Counter_Tick" and try...

VB
<asp:Timer ID="timer_Counter" runat="server" Interval = "1000">
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900