Click here to Skip to main content
12,501,833 members (50,858 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: Text updatepanel
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 15-Aug-12 19:03pm
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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();
  Permalink  
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.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

can u please post the aspx page content...
  Permalink  
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,
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

in your code where is upadate panel, async trigger...

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

<asp:Timer ID="timer_Counter" runat="server" Interval = "1000">
  Permalink  
v3

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160919.1 | Last Updated 17 Aug 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100