Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > AJAX UpdatePanel lost focus

Reply
Thread Tools

AJAX UpdatePanel lost focus

 
 
Madison
Guest
Posts: n/a
 
      01-12-2010
Hi There,
I'm writing web application VB VS2008 with ajax. My page has user control
and textboxes. I group the textbox together and have 3 <asp:updatePanel ...
updatemode="Conditional"> each group has about 6 textboxes each textboxes
has AutoPostBack=true when I go to the third textbox with focus on, I cannot
type any characters to the box. Please helps. Thanks.
 
Reply With Quote
 
 
 
 
Zhi-Qiang Ni[MSFT]
Guest
Posts: n/a
 
      01-13-2010
Hi Madison,

I have made a test application based on your description. After testing it,
I found that if we type some value into the first TextBox and then click
the second one, the cursor would disappear and we cannot type value into
the second one. Please tell me whether this behavior is the same to what
your mentioned.

If so, let me explain the cause of the behavior first.

We type some values into the first TextBox and then click the other place
of the window, the page would be refreshed because we set the AutoPostBack
property of the TextBox with true. Although we click the second TextBox,
the application would run the server side post back firstly whether these
controls are inside the UpdatePanel or not. The cursor which is inside the
second TextBox would disappear because the page's post back. This is the
default setting by the ASP.NET Life-cycle.

If these TextBoxes are placed into an UpdatePanel, we cannot see the
refresh of the page, so, the cursor's disappearance would be weird.

To make a workaround, we can set the AutoPostBack property with false. In
the second TextBox's client side click event, doPostBack and store the
current TextBox into a HiddenField. In the end, set the focus() function
after the asynchronous request is ended.

Refer to this sample:
<%@ Page Language="vb" AutoEventWireup="false"
CodeBehind="TestUpdatePanel.aspx.vb"
Inherits="_44456996.TestUpdatePanel" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:HiddenField ID="HF1" runat="server" />
<div style="border-style: solid; border-width: thin">
TextBoxes outside the UpdatePanel<br />
Type into first TextBox and then click the second one,<br />
the page would be refreshed.<br />
<asp:TextBox ID="TextBox1" runat="server"
onclick="TextBoxOnClick(this)" AutoPostBack="false"></asp:TextBox><br />
<asp:TextBox ID="TextBox2" runat="server"
onclick="TextBoxOnClick(this)" AutoPostBack="false"></asp:TextBox><br />
<asp:TextBox ID="TextBox3" runat="server"
onclick="TextBoxOnClick(this)" AutoPostBack="false"></asp:TextBox><br />
</div>
<hr />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div style="border-style: solid; border-width: thin">
TextBoxes inside the UpdatePanel<br />
Type into first TextBox and then click the second
one,<br />
the page would NOT be refreshed.<br />
That's what your mentioned.<br />
<asp:TextBox ID="TextBox4" runat="server"
onclick="TextBoxOnClick(this)" AutoPostBack="false"></asp:TextBox><br />
<asp:TextBox ID="TextBox5" runat="server"
onclick="TextBoxOnClick(this)" AutoPostBack="false"></asp:TextBox><br />
<asp:TextBox ID="TextBox6" runat="server"
onclick="TextBoxOnClick(this)" AutoPostBack="false"></asp:TextBox><br />
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>

<script type="text/javascript">

Sys.WebForms.PageRequestManager.getInstance().add_ endRequest(
function(sender, e) {
if ($get("HF1").value) {
var textbox = $get($get("HF1").value);
textbox.select();
textbox.focus();
}
});

function TextBoxOnClick(tb) {
if ($get("HF1").value != tb.id) {
$get("HF1").value = tb.id;
__doPostBack(tb.id, "");
}
}

</script>

</form>
</body>
</html>


Note that, to make these script run correctly, please place the script tag
under the ScriptManager control.

Another choice is set the AutoPostBack property with false and use a Button
to make a post back.

Meanwhile, I think these tutorials of the UpdatePanel can help you use it
and understand the AJAX function more clearly:

http://www.asp.net/AJAX/Documentatio...lOverview.aspx
http://www.asp.net/AJAX/Documentatio...tePanelControl
s.aspx

Understanding Partial Page Updates with ASP.NET AJAX
http://www.asp.net/learn/ajax/tutorial-01-cs.aspx

How Do I:Implement Dynamic Partial-Page Updates with ASP.NET AJAX?
http://www.asp.net/learn/ajax-videos/video-78.aspx

How Do I:Use JavaScript to Refresh an ASP.NET AJAX UpdatePanel?
http://www.asp.net/learn/ajax-videos/video-172.aspx

How Do I:Use the Conditional UpdateMode of the UpdatePanel?
http://www.asp.net/learn/ajax-videos/video-177.aspx

How Do I:Trigger an UpdatePanel Refresh from a DropDownList Control?
http://www.asp.net/learn/ajax-videos/video-183.aspx

How To Dynamically Change CSS Using the ASP.NET AJAX UpdatePanel
http://www.asp.net/learn/ajax-videos/video-285.aspx

--
Sincerely,

Zhi-Qiang Ni

Microsoft Online Support


==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

MSDN Managed Newsgroup support offering is for non-urgent issues where an
initial response from the community or a Microsoft Support Engineer within
2 business day is acceptable. Please note that each follow up response may
take approximately 2 business days as the support professional working with
you may need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations that require urgent,
real-time or phone-based interactions. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
==================================================

--------------------
| Thread-Topic: AJAX UpdatePanel lost focus
| thread-index: AcqTs/64Rn3xAuuZRU6L+HzRGFvxbg==
| X-WBNR-Posting-Host: 165.189.6.46
| From: Madison <(E-Mail Removed)>
| Subject: AJAX UpdatePanel lost focus
| Date: Tue, 12 Jan 2010 10:21:01 -0800
| Lines: 6
| Message-ID: <(E-Mail Removed)>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4325
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Path: TK2MSFTNGHUB02.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:95729
| NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Hi There,
| I'm writing web application VB VS2008 with ajax. My page has user
control
| and textboxes. I group the textbox together and have 3 <asp:updatePanel
...
| updatemode="Conditional"> each group has about 6 textboxes each textboxes

| has AutoPostBack=true when I go to the third textbox with focus on, I
cannot
| type any characters to the box. Please helps. Thanks.
|

 
Reply With Quote
 
 
 
 
Madison
Guest
Posts: n/a
 
      01-13-2010
Thank you for your reply.
Here is my coding and problems that I try to do

<asp:UpdatePanel ID="UpdatePanel4" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table border="1" style="border-collapse:collapse">
<tr>
<td colspan="2"><b>Calculation of assessable revenues for
remainder and telephone relay addessement purposes:</b></td>
<td align="right">Amount<br /><i>(000's)</i></td>
<td style="width:20%"> </td>
</tr>
<tr>
<td valign="top">1.</td>
<td valign="top">Gross Operating Revenues—Wisconsin
(including interstate revenues)</td>
<td align="right"><span
class="required">*</span><asp:TextBox ID="GrossOperateRev" runat="server"
CssClass="enabledRight" Width="110px" AutoPostBack="true" /></td>
<td><asp:Label ID="lblGrossOperateRev" runat="server"
CssClass="required" /></td>
</tr>
<tr>
<td valign="top">2.</td>
<td valign="top">Less: Inbound interstate 800 and collect
revenues billed to customers outside of Wisconsin and included on line 1</td>
<td align="right"><span
class="required">*</span><asp:TextBox ID="InboundRev" runat="server"
CssClass="enabledRight" Width="110px" AutoPostBack="true" /></td>
<td><asp:Label ID="lblInboundRev" runat="server"
CssClass="required" /></td>
</tr>
<tr>
<td valign="top">3.</td>
<td valign="top">Less: Current year write-offs of
uncollectible revenues </td>
<td align="right"><span
class="required">*</span><asp:TextBox ID="CurrWriteOff" runat="server"
CssClass="enabledRight" Width="110px" AutoPostBack="true" /></td>
<td><asp:Label ID="lblCurrWriteOff" runat="server"
CssClass="required" /></td>
</tr>
<tr>
<td valign="top">4.</td>
<td valign="top">Plus: Current year collection of operating
revenues previously written off</td>
<td align="right"><span
class="required">*</span><asp:TextBox ID="CurrCollectRev" runat="server"
CssClass="enabledRight" Width="110px" AutoPostBack="true" /></td>
<td><asp:Label ID="lblCurrCollectRev" runat="server"
CssClass="required" /></td>
</tr>
<tr>
<td valign="top">5.</td>
<td valign="top">Less: Revenues included in line 1 that are
not assessable for remainder and telephone relay assessment purposes</td>
<td align="right"><span
class="required">*</span><asp:TextBox ID="RevNotAsses" runat="server"
CssClass="enabledRight" Width="110px" AutoPostBack="true" /></td>
<td><asp:Label ID="lblRevNotAsses" runat="server"
CssClass="required" /></td>
</tr>
<tr>
<td valign="top">6.</td>
<td valign="top">Total assessable revenues for remainder and
relay assessment purposes</td>
<td align="right"><asp:TextBox ID="TotalAssesRev"
runat="server" CssClass="disabledRight" Width="110px" ReadOnly="true"
Font-Bold="true" /></td>
<td> </td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>

The textbox for no.6 will have the total values of 1-5 and everytime the
value change the line 6 total will get update. The AutoPostsBack need to set
to true for re-calculate the line 6. Each textbox 1-5 have the the
TextChanged event that call the function to calculate the total then follow
by ScriptManager1.SetFocus(textboxname.ClientID) to set focus on the next
box. I can see the cursor at the next textbox but I cannot enter any values
to the box. This is only one group of the textbox, I will have more group of
textbox familiar to this in the page. I cannot use the button to calculate
because it means that users must click button everytime they enter the
values.

Any suggestion would be appreciate. Thanks.


"Zhi-Qiang Ni[MSFT]" wrote:

> Hi Madison,
>
> I have made a test application based on your description. After testing it,
> I found that if we type some value into the first TextBox and then click
> the second one, the cursor would disappear and we cannot type value into
> the second one. Please tell me whether this behavior is the same to what
> your mentioned.
>
> If so, let me explain the cause of the behavior first.
>
> We type some values into the first TextBox and then click the other place
> of the window, the page would be refreshed because we set the AutoPostBack
> property of the TextBox with true. Although we click the second TextBox,
> the application would run the server side post back firstly whether these
> controls are inside the UpdatePanel or not. The cursor which is inside the
> second TextBox would disappear because the page's post back. This is the
> default setting by the ASP.NET Life-cycle.
>
> If these TextBoxes are placed into an UpdatePanel, we cannot see the
> refresh of the page, so, the cursor's disappearance would be weird.
>
> To make a workaround, we can set the AutoPostBack property with false. In
> the second TextBox's client side click event, doPostBack and store the
> current TextBox into a HiddenField. In the end, set the focus() function
> after the asynchronous request is ended.
>
> Refer to this sample:
> <%@ Page Language="vb" AutoEventWireup="false"
> CodeBehind="TestUpdatePanel.aspx.vb"
> Inherits="_44456996.TestUpdatePanel" %>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head runat="server">
> <title></title>
> </head>
> <body>
> <form id="form1" runat="server">
> <div>
> <asp:ScriptManager ID="ScriptManager1" runat="server" />
> <asp:HiddenField ID="HF1" runat="server" />
> <div style="border-style: solid; border-width: thin">
> TextBoxes outside the UpdatePanel<br />
> Type into first TextBox and then click the second one,<br />
> the page would be refreshed.<br />
> <asp:TextBox ID="TextBox1" runat="server"
> onclick="TextBoxOnClick(this)" AutoPostBack="false"></asp:TextBox><br />
> <asp:TextBox ID="TextBox2" runat="server"
> onclick="TextBoxOnClick(this)" AutoPostBack="false"></asp:TextBox><br />
> <asp:TextBox ID="TextBox3" runat="server"
> onclick="TextBoxOnClick(this)" AutoPostBack="false"></asp:TextBox><br />
> </div>
> <hr />
> <asp:UpdatePanel ID="UpdatePanel1" runat="server">
> <ContentTemplate>
> <div style="border-style: solid; border-width: thin">
> TextBoxes inside the UpdatePanel<br />
> Type into first TextBox and then click the second
> one,<br />
> the page would NOT be refreshed.<br />
> That's what your mentioned.<br />
> <asp:TextBox ID="TextBox4" runat="server"
> onclick="TextBoxOnClick(this)" AutoPostBack="false"></asp:TextBox><br />
> <asp:TextBox ID="TextBox5" runat="server"
> onclick="TextBoxOnClick(this)" AutoPostBack="false"></asp:TextBox><br />
> <asp:TextBox ID="TextBox6" runat="server"
> onclick="TextBoxOnClick(this)" AutoPostBack="false"></asp:TextBox><br />
> </div>
> </ContentTemplate>
> </asp:UpdatePanel>
> </div>
>
> <script type="text/javascript">
>
> Sys.WebForms.PageRequestManager.getInstance().add_ endRequest(
> function(sender, e) {
> if ($get("HF1").value) {
> var textbox = $get($get("HF1").value);
> textbox.select();
> textbox.focus();
> }
> });
>
> function TextBoxOnClick(tb) {
> if ($get("HF1").value != tb.id) {
> $get("HF1").value = tb.id;
> __doPostBack(tb.id, "");
> }
> }
>
> </script>
>
> </form>
> </body>
> </html>
>
>
> Note that, to make these script run correctly, please place the script tag
> under the ScriptManager control.
>
> Another choice is set the AutoPostBack property with false and use a Button
> to make a post back.
>
> Meanwhile, I think these tutorials of the UpdatePanel can help you use it
> and understand the AJAX function more clearly:
>
> http://www.asp.net/AJAX/Documentatio...lOverview.aspx
> http://www.asp.net/AJAX/Documentatio...tePanelControl
> s.aspx
>
> Understanding Partial Page Updates with ASP.NET AJAX
> http://www.asp.net/learn/ajax/tutorial-01-cs.aspx
>
> How Do I:Implement Dynamic Partial-Page Updates with ASP.NET AJAX?
> http://www.asp.net/learn/ajax-videos/video-78.aspx
>
> How Do I:Use JavaScript to Refresh an ASP.NET AJAX UpdatePanel?
> http://www.asp.net/learn/ajax-videos/video-172.aspx
>
> How Do I:Use the Conditional UpdateMode of the UpdatePanel?
> http://www.asp.net/learn/ajax-videos/video-177.aspx
>
> How Do I:Trigger an UpdatePanel Refresh from a DropDownList Control?
> http://www.asp.net/learn/ajax-videos/video-183.aspx
>
> How To Dynamically Change CSS Using the ASP.NET AJAX UpdatePanel
> http://www.asp.net/learn/ajax-videos/video-285.aspx
>
> --
> Sincerely,
>
> Zhi-Qiang Ni
>
> Microsoft Online Support
>
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/en-us/subs...#notifications.
>
> MSDN Managed Newsgroup support offering is for non-urgent issues where an
> initial response from the community or a Microsoft Support Engineer within
> 2 business day is acceptable. Please note that each follow up response may
> take approximately 2 business days as the support professional working with
> you may need further investigation to reach the most efficient resolution.
> The offering is not appropriate for situations that require urgent,
> real-time or phone-based interactions. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
> ==================================================
>
> --------------------
> | Thread-Topic: AJAX UpdatePanel lost focus
> | thread-index: AcqTs/64Rn3xAuuZRU6L+HzRGFvxbg==
> | X-WBNR-Posting-Host: 165.189.6.46
> | From: Madison <(E-Mail Removed)>
> | Subject: AJAX UpdatePanel lost focus
> | Date: Tue, 12 Jan 2010 10:21:01 -0800
> | Lines: 6
> | Message-ID: <(E-Mail Removed)>
> | MIME-Version: 1.0
> | Content-Type: text/plain;
> | charset="Utf-8"
> | Content-Transfer-Encoding: 7bit
> | X-Newsreader: Microsoft CDO for Windows 2000
> | Content-Class: urn:content-classes:message
> | Importance: normal
> | Priority: normal
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4325
> | Newsgroups: microsoft.public.dotnet.framework.aspnet
> | Path: TK2MSFTNGHUB02.phx.gbl
> | Xref: TK2MSFTNGHUB02.phx.gbl
> microsoft.public.dotnet.framework.aspnet:95729
> | NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
> |
> | Hi There,
> | I'm writing web application VB VS2008 with ajax. My page has user
> control
> | and textboxes. I group the textbox together and have 3 <asp:updatePanel
> ...
> | updatemode="Conditional"> each group has about 6 textboxes each textboxes
>
> | has AutoPostBack=true when I go to the third textbox with focus on, I
> cannot
> | type any characters to the box. Please helps. Thanks.
> |
>
> .
>

 
Reply With Quote
 
Zhi-Qiang Ni[MSFT]
Guest
Posts: n/a
 
      01-14-2010
Hi Madison,

I have explained that if we set the AutoPostBack with true, the focus of
TextBox would always disappear by the page's reloaded. Although we can set
focus on the Control which makes this post back by using the ScriptManager
class setFocus method, there is no way to know which control is clicked.

So, I think we have to set the AutoPostBack with false to enable the client
side behavior. As a workaround, we can use the Timer control to make a post
back and calculate the sum for TextBox6.

Refer to this:

<%@ Page Language="vb" AutoEventWireup="false"
CodeBehind="TestUpdatePanel.aspx.vb"
Inherits="_44456996.TestUpdatePanel" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div style="border-style: solid; border-width: thin">
Value1:<asp:TextBox ID="TextBox1" runat="server"
AutoPostBack="false"></asp:TextBox>
<asp:Label ID="Label1" runat="server"
Text="Label"></asp:Label><br />
Value2:<asp:TextBox ID="TextBox2" runat="server"
AutoPostBack="false"></asp:TextBox>
<asp:Label ID="Label2" runat="server"
Text="Label"></asp:Label><br />
Value3:<asp:TextBox ID="TextBox3" runat="server"
AutoPostBack="false"></asp:TextBox>
<asp:Label ID="Label3" runat="server"
Text="Label"></asp:Label><br />
Value4:<asp:TextBox ID="TextBox4" runat="server"
AutoPostBack="false"></asp:TextBox>
<asp:Label ID="Label4" runat="server"
Text="Label"></asp:Label><br />
Value5:<asp:TextBox ID="TextBox5" runat="server"
AutoPostBack="false"></asp:TextBox>
<asp:Label ID="Label5" runat="server"
Text="Label"></asp:Label><br />
SUM:<asp:TextBox ID="TextBox6" runat="server"
AutoPostBack="false" ReadOnly="true"></asp:TextBox><br />
<asp:Timer ID="Timer1" runat="server" Interval="2000">
</asp:Timer>
</div>
<asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
</div>

<script runat="server">
Private Sub Sum()

If String.IsNullOrEmpty(TextBox1.Text) Then
Label1.Text = 0
Else
Label1.Text = TextBox1.Text
End If
If String.IsNullOrEmpty(TextBox2.Text) Then
Label2.Text = 0
Else
Label2.Text = TextBox2.Text
End If
If String.IsNullOrEmpty(TextBox3.Text) Then
Label3.Text = 0
Else
Label3.Text = TextBox3.Text
End If
If String.IsNullOrEmpty(TextBox4.Text) Then
Label4.Text = 0
Else
Label4.Text = TextBox4.Text
End If
If String.IsNullOrEmpty(TextBox5.Text) Then
Label5.Text = 0
Else
Label5.Text = TextBox5.Text
End If
TextBox6.Text = (CInt(Label1.Text) + CInt(Label2.Text) +
CInt(Label3.Text) + CInt(Label4.Text) + CInt(Label5.Text)).ToString

End Sub

Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
Sum()
End Sub

</script>

</form>
</body>
</html>


Please test it and let me know the result.

--
Sincerely,

Zhi-Qiang Ni

Microsoft Online Support


==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

MSDN Managed Newsgroup support offering is for non-urgent issues where an
initial response from the community or a Microsoft Support Engineer within
2 business day is acceptable. Please note that each follow up response may
take approximately 2 business days as the support professional working with
you may need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations that require urgent,
real-time or phone-based interactions. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
==================================================


 
Reply With Quote
 
Zhi-Qiang Ni[MSFT]
Guest
Posts: n/a
 
      01-14-2010
Hi Madison,

I have modified some of my code, maybe this behavior can be more smoother.
I use a HiddenField to store the clicked TextBox's ID and then setfocus
back in the Timer's tick event.

Here is the code:
<%@ Page Language="vb" AutoEventWireup="false"
CodeBehind="TestUpdatePanel.aspx.vb"
Inherits="_44456996.TestUpdatePanel" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:HiddenField ID="HF1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div style="border-style: solid; border-width: thin">
Value1:<asp:TextBox ID="TextBox1" runat="server"
onclick="TextBoxOnClick(this)" onblur="TextBoxOnBlur(this)"
AutoPostBack="false"></asp:TextBox>
<asp:Label ID="Label1" runat="server"
Text="Label"></asp:Label><br />
Value2:<asp:TextBox ID="TextBox2" runat="server"
onclick="TextBoxOnClick(this)" onblur="TextBoxOnBlur(this)"
AutoPostBack="false"></asp:TextBox>
<asp:Label ID="Label2" runat="server"
Text="Label"></asp:Label><br />
Value3:<asp:TextBox ID="TextBox3" runat="server"
onclick="TextBoxOnClick(this)" onblur="TextBoxOnBlur(this)"
AutoPostBack="false"></asp:TextBox>
<asp:Label ID="Label3" runat="server"
Text="Label"></asp:Label><br />
Value4:<asp:TextBox ID="TextBox4" runat="server"
onclick="TextBoxOnClick(this)" onblur="TextBoxOnBlur(this)"
AutoPostBack="false"></asp:TextBox>
<asp:Label ID="Label4" runat="server"
Text="Label"></asp:Label><br />
Value5:<asp:TextBox ID="TextBox5" runat="server"
onclick="TextBoxOnClick(this)" onblur="TextBoxOnBlur(this)"
AutoPostBack="false"></asp:TextBox>
<asp:Label ID="Label5" runat="server"
Text="Label"></asp:Label><br />
SUM:<asp:TextBox ID="TextBox6" runat="server"
AutoPostBack="false" ReadOnly="true"></asp:TextBox><br />
<asp:Timer ID="Timer1" runat="server" Interval="2000">
</asp:Timer>
</div>
<asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
</div>

<script type="text/javascript">
function TextBoxOnClick(tb) {
$get("HF1").value = tb.id;
}

function TextBoxOnBlur(tb) {
$get("HF1").value = "";
}
</script>

<script runat="server">
Private Sub Sum()

If String.IsNullOrEmpty(TextBox1.Text) Then
Label1.Text = 0
Else
Label1.Text = TextBox1.Text
End If
If String.IsNullOrEmpty(TextBox2.Text) Then
Label2.Text = 0
Else
Label2.Text = TextBox2.Text
End If
If String.IsNullOrEmpty(TextBox3.Text) Then
Label3.Text = 0
Else
Label3.Text = TextBox3.Text
End If
If String.IsNullOrEmpty(TextBox4.Text) Then
Label4.Text = 0
Else
Label4.Text = TextBox4.Text
End If
If String.IsNullOrEmpty(TextBox5.Text) Then
Label5.Text = 0
Else
Label5.Text = TextBox5.Text
End If

TextBox6.Text = (CInt(Label1.Text) + CInt(Label2.Text) +
CInt(Label3.Text) + CInt(Label4.Text) + CInt(Label5.Text)).ToString

End Sub

Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
Sum()
If Not String.IsNullOrEmpty(HF1.Value) Then
ScriptManager1.SetFocus(HF1.Value)
'ScriptManager.RegisterClientScriptBlock(Me.Page,
GetType(Page), "select", "$get('" + HF1.Value + "').select();", True)
End If
End Sub

</script>

</form>
</body>
</html>

--
Sincerely,

Zhi-Qiang Ni

Microsoft Online Support


==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

MSDN Managed Newsgroup support offering is for non-urgent issues where an
initial response from the community or a Microsoft Support Engineer within
2 business day is acceptable. Please note that each follow up response may
take approximately 2 business days as the support professional working with
you may need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations that require urgent,
real-time or phone-based interactions. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
==================================================


 
Reply With Quote
 
Madison
Guest
Posts: n/a
 
      01-14-2010
Hi Zhi-Qiang Ni,

Thank you for your sample codes. I created new page and pasted your sample
and run. It did not work for me. I still have the same problem when I try to
enter the values into the textbox.



"Zhi-Qiang Ni[MSFT]" wrote:

> Hi Madison,
>
> I have modified some of my code, maybe this behavior can be more smoother.
> I use a HiddenField to store the clicked TextBox's ID and then setfocus
> back in the Timer's tick event.
>
> Here is the code:
> <%@ Page Language="vb" AutoEventWireup="false"
> CodeBehind="TestUpdatePanel.aspx.vb"
> Inherits="_44456996.TestUpdatePanel" %>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head runat="server">
> <title></title>
> </head>
> <body>
> <form id="form1" runat="server">
> <div>
> <asp:ScriptManager ID="ScriptManager1" runat="server" />
> <asp:HiddenField ID="HF1" runat="server" />
> <asp:UpdatePanel ID="UpdatePanel1" runat="server">
> <ContentTemplate>
> <div style="border-style: solid; border-width: thin">
> Value1:<asp:TextBox ID="TextBox1" runat="server"
> onclick="TextBoxOnClick(this)" onblur="TextBoxOnBlur(this)"
> AutoPostBack="false"></asp:TextBox>
> <asp:Label ID="Label1" runat="server"
> Text="Label"></asp:Label><br />
> Value2:<asp:TextBox ID="TextBox2" runat="server"
> onclick="TextBoxOnClick(this)" onblur="TextBoxOnBlur(this)"
> AutoPostBack="false"></asp:TextBox>
> <asp:Label ID="Label2" runat="server"
> Text="Label"></asp:Label><br />
> Value3:<asp:TextBox ID="TextBox3" runat="server"
> onclick="TextBoxOnClick(this)" onblur="TextBoxOnBlur(this)"
> AutoPostBack="false"></asp:TextBox>
> <asp:Label ID="Label3" runat="server"
> Text="Label"></asp:Label><br />
> Value4:<asp:TextBox ID="TextBox4" runat="server"
> onclick="TextBoxOnClick(this)" onblur="TextBoxOnBlur(this)"
> AutoPostBack="false"></asp:TextBox>
> <asp:Label ID="Label4" runat="server"
> Text="Label"></asp:Label><br />
> Value5:<asp:TextBox ID="TextBox5" runat="server"
> onclick="TextBoxOnClick(this)" onblur="TextBoxOnBlur(this)"
> AutoPostBack="false"></asp:TextBox>
> <asp:Label ID="Label5" runat="server"
> Text="Label"></asp:Label><br />
> SUM:<asp:TextBox ID="TextBox6" runat="server"
> AutoPostBack="false" ReadOnly="true"></asp:TextBox><br />
> <asp:Timer ID="Timer1" runat="server" Interval="2000">
> </asp:Timer>
> </div>
> <asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>
> </ContentTemplate>
> </asp:UpdatePanel>
> </div>
>
> <script type="text/javascript">
> function TextBoxOnClick(tb) {
> $get("HF1").value = tb.id;
> }
>
> function TextBoxOnBlur(tb) {
> $get("HF1").value = "";
> }
> </script>
>
> <script runat="server">
> Private Sub Sum()
>
> If String.IsNullOrEmpty(TextBox1.Text) Then
> Label1.Text = 0
> Else
> Label1.Text = TextBox1.Text
> End If
> If String.IsNullOrEmpty(TextBox2.Text) Then
> Label2.Text = 0
> Else
> Label2.Text = TextBox2.Text
> End If
> If String.IsNullOrEmpty(TextBox3.Text) Then
> Label3.Text = 0
> Else
> Label3.Text = TextBox3.Text
> End If
> If String.IsNullOrEmpty(TextBox4.Text) Then
> Label4.Text = 0
> Else
> Label4.Text = TextBox4.Text
> End If
> If String.IsNullOrEmpty(TextBox5.Text) Then
> Label5.Text = 0
> Else
> Label5.Text = TextBox5.Text
> End If
>
> TextBox6.Text = (CInt(Label1.Text) + CInt(Label2.Text) +
> CInt(Label3.Text) + CInt(Label4.Text) + CInt(Label5.Text)).ToString
>
> End Sub
>
> Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Timer1.Tick
> Sum()
> If Not String.IsNullOrEmpty(HF1.Value) Then
> ScriptManager1.SetFocus(HF1.Value)
> 'ScriptManager.RegisterClientScriptBlock(Me.Page,
> GetType(Page), "select", "$get('" + HF1.Value + "').select();", True)
> End If
> End Sub
>
> </script>
>
> </form>
> </body>
> </html>
>
> --
> Sincerely,
>
> Zhi-Qiang Ni
>
> Microsoft Online Support
>
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/en-us/subs...#notifications.
>
> MSDN Managed Newsgroup support offering is for non-urgent issues where an
> initial response from the community or a Microsoft Support Engineer within
> 2 business day is acceptable. Please note that each follow up response may
> take approximately 2 business days as the support professional working with
> you may need further investigation to reach the most efficient resolution.
> The offering is not appropriate for situations that require urgent,
> real-time or phone-based interactions. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
> ==================================================
>
>
> .
>

 
Reply With Quote
 
Zhi-Qiang Ni[MSFT]
Guest
Posts: n/a
 
      01-15-2010
Hi Madison,

I try to achieve your goal by using the client side function. Refer to this
code:

<%@ Page Language="vb" AutoEventWireup="false"
CodeBehind="TestClientFunction.aspx.vb"
Inherits="_44456996.TestClientFunction" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:HiddenField ID="HF1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div style="border-style: solid; border-width: thin">
Value1:<asp:TextBox ID="TextBox1" runat="server"
onblur="TextBoxOnBlur()" onkeypress="TextBoxOnKeyPress()"
AutoPostBack="false"></asp:TextBox>
<asp:RegularExpressionValidator
ID="RegularExpressionValidator1" runat="server" ErrorMessage="Please enter
a Number"
ControlToValidate="TextBox1"
ValidationExpression="\d+"></asp:RegularExpressionValidator>
<asp:Label ID="Label1" runat="server" ></asp:Label><br
/>
Value2:<asp:TextBox ID="TextBox2" runat="server"
onblur="TextBoxOnBlur()" onkeypress="TextBoxOnKeyPress()"
AutoPostBack="false"></asp:TextBox>
<asp:RegularExpressionValidator
ID="RegularExpressionValidator2" runat="server" ErrorMessage="Please enter
a Number"
ControlToValidate="TextBox2"
ValidationExpression="\d+"></asp:RegularExpressionValidator>
<asp:Label ID="Label2" runat="server" ></asp:Label><br
/>
Value3:<asp:TextBox ID="TextBox3" runat="server"
onblur="TextBoxOnBlur()" onkeypress="TextBoxOnKeyPress()"
AutoPostBack="false"></asp:TextBox>
<asp:RegularExpressionValidator
ID="RegularExpressionValidator3" runat="server" ErrorMessage="Please enter
a Number"
ControlToValidate="TextBox3"
ValidationExpression="\d+"></asp:RegularExpressionValidator>
<asp:Label ID="Label3" runat="server" ></asp:Label><br
/>
Value4:<asp:TextBox ID="TextBox4" runat="server"
onblur="TextBoxOnBlur()" onkeypress="TextBoxOnKeyPress()"
AutoPostBack="false"></asp:TextBox>
<asp:RegularExpressionValidator
ID="RegularExpressionValidator4" runat="server" ErrorMessage="Please enter
a Number"
ControlToValidate="TextBox4"
ValidationExpression="\d+"></asp:RegularExpressionValidator>
<asp:Label ID="Label4" runat="server" ></asp:Label><br
/>
Value5:<asp:TextBox ID="TextBox5" runat="server"
onblur="TextBoxOnBlur()" onkeypress="TextBoxOnKeyPress()"
AutoPostBack="false"></asp:TextBox>
<asp:RegularExpressionValidator
ID="RegularExpressionValidator5" runat="server" ErrorMessage="Please enter
a Number"
ControlToValidate="TextBox5"
ValidationExpression="\d+"></asp:RegularExpressionValidator>
<asp:Label ID="Label5" runat="server" ></asp:Label><br
/>
SUM:<asp:TextBox ID="TextBox6" runat="server"
AutoPostBack="true" ReadOnly="true"></asp:TextBox><br />
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>

<script type="text/javascript">

function TextBoxOnBlur(tb) {
Sum();
}

function TextBoxOnKeyPress() {
if (event.keyCode == 13) {
Sum();
}
}

function Sum() {

if (!Page_IsValid) { return; }

var value = new Array(5);
var SumValue = 0;

for (i = 1; i < 6; i++) {
if ($get("TextBox" + i).value == "") {
value[i] = 0;
} else {
value[i] = parseInt($get("TextBox" + i).value);
}

$get("Label" + i).innerHTML = value[i];
SumValue = SumValue + value[i];
}

$get("TextBox6").value = SumValue.toString();
}

</script>

</form>
</body>
</html>

--
Sincerely,

Zhi-Qiang Ni

Microsoft Online Support


==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

MSDN Managed Newsgroup support offering is for non-urgent issues where an
initial response from the community or a Microsoft Support Engineer within
2 business day is acceptable. Please note that each follow up response may
take approximately 2 business days as the support professional working with
you may need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations that require urgent,
real-time or phone-based interactions. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
==================================================

--------------------
| Thread-Topic: AJAX UpdatePanel lost focus
| thread-index: AcqVLFe77QoByPq0RQOM9yTz7MzwkA==
| X-WBNR-Posting-Host: 165.189.6.46
| From: Madison <(E-Mail Removed)>
| References: <(E-Mail Removed)>
<(E-Mail Removed)>
<(E-Mail Removed)>
<(E-Mail Removed)>
| Subject: RE: AJAX UpdatePanel lost focus
| Date: Thu, 14 Jan 2010 07:15:01 -0800
| Lines: 157
| Message-ID: <(E-Mail Removed)>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4325
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Path: TK2MSFTNGHUB02.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:95775
| NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Hi Zhi-Qiang Ni,
|
| Thank you for your sample codes. I created new page and pasted your
sample
| and run. It did not work for me. I still have the same problem when I try
to
| enter the values into the textbox.
|
|

 
Reply With Quote
 
Madison
Guest
Posts: n/a
 
      01-15-2010
Hi Zhi-Qiang Ni,

Thank you for your help. Your samples for using the client side give me the
idea that I will switch my coding to use javascript for display the total
check and validation. I still have the server side validation before saving
to database. I thought that AJAX will help me with less coding but I guess
not. I hope that the new release VS2010 will make the things better. Thank
you again for your helps.


"Zhi-Qiang Ni[MSFT]" wrote:

> Hi Madison,
>
> I try to achieve your goal by using the client side function. Refer to this
> code:
>
> <%@ Page Language="vb" AutoEventWireup="false"
> CodeBehind="TestClientFunction.aspx.vb"
> Inherits="_44456996.TestClientFunction" %>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head runat="server">
> <title></title>
> </head>
> <body>
> <form id="form1" runat="server">
> <div>
> <asp:ScriptManager ID="ScriptManager1" runat="server" />
> <asp:HiddenField ID="HF1" runat="server" />
> <asp:UpdatePanel ID="UpdatePanel1" runat="server">
> <ContentTemplate>
> <div style="border-style: solid; border-width: thin">
> Value1:<asp:TextBox ID="TextBox1" runat="server"
> onblur="TextBoxOnBlur()" onkeypress="TextBoxOnKeyPress()"
> AutoPostBack="false"></asp:TextBox>
> <asp:RegularExpressionValidator
> ID="RegularExpressionValidator1" runat="server" ErrorMessage="Please enter
> a Number"
> ControlToValidate="TextBox1"
> ValidationExpression="\d+"></asp:RegularExpressionValidator>
> <asp:Label ID="Label1" runat="server" ></asp:Label><br
> />
> Value2:<asp:TextBox ID="TextBox2" runat="server"
> onblur="TextBoxOnBlur()" onkeypress="TextBoxOnKeyPress()"
> AutoPostBack="false"></asp:TextBox>
> <asp:RegularExpressionValidator
> ID="RegularExpressionValidator2" runat="server" ErrorMessage="Please enter
> a Number"
> ControlToValidate="TextBox2"
> ValidationExpression="\d+"></asp:RegularExpressionValidator>
> <asp:Label ID="Label2" runat="server" ></asp:Label><br
> />
> Value3:<asp:TextBox ID="TextBox3" runat="server"
> onblur="TextBoxOnBlur()" onkeypress="TextBoxOnKeyPress()"
> AutoPostBack="false"></asp:TextBox>
> <asp:RegularExpressionValidator
> ID="RegularExpressionValidator3" runat="server" ErrorMessage="Please enter
> a Number"
> ControlToValidate="TextBox3"
> ValidationExpression="\d+"></asp:RegularExpressionValidator>
> <asp:Label ID="Label3" runat="server" ></asp:Label><br
> />
> Value4:<asp:TextBox ID="TextBox4" runat="server"
> onblur="TextBoxOnBlur()" onkeypress="TextBoxOnKeyPress()"
> AutoPostBack="false"></asp:TextBox>
> <asp:RegularExpressionValidator
> ID="RegularExpressionValidator4" runat="server" ErrorMessage="Please enter
> a Number"
> ControlToValidate="TextBox4"
> ValidationExpression="\d+"></asp:RegularExpressionValidator>
> <asp:Label ID="Label4" runat="server" ></asp:Label><br
> />
> Value5:<asp:TextBox ID="TextBox5" runat="server"
> onblur="TextBoxOnBlur()" onkeypress="TextBoxOnKeyPress()"
> AutoPostBack="false"></asp:TextBox>
> <asp:RegularExpressionValidator
> ID="RegularExpressionValidator5" runat="server" ErrorMessage="Please enter
> a Number"
> ControlToValidate="TextBox5"
> ValidationExpression="\d+"></asp:RegularExpressionValidator>
> <asp:Label ID="Label5" runat="server" ></asp:Label><br
> />
> SUM:<asp:TextBox ID="TextBox6" runat="server"
> AutoPostBack="true" ReadOnly="true"></asp:TextBox><br />
> </div>
> </ContentTemplate>
> </asp:UpdatePanel>
> </div>
>
> <script type="text/javascript">
>
> function TextBoxOnBlur(tb) {
> Sum();
> }
>
> function TextBoxOnKeyPress() {
> if (event.keyCode == 13) {
> Sum();
> }
> }
>
> function Sum() {
>
> if (!Page_IsValid) { return; }
>
> var value = new Array(5);
> var SumValue = 0;
>
> for (i = 1; i < 6; i++) {
> if ($get("TextBox" + i).value == "") {
> value[i] = 0;
> } else {
> value[i] = parseInt($get("TextBox" + i).value);
> }
>
> $get("Label" + i).innerHTML = value[i];
> SumValue = SumValue + value[i];
> }
>
> $get("TextBox6").value = SumValue.toString();
> }
>
> </script>
>
> </form>
> </body>
> </html>
>
> --
> Sincerely,
>
> Zhi-Qiang Ni
>
> Microsoft Online Support
>
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/en-us/subs...#notifications.
>
> MSDN Managed Newsgroup support offering is for non-urgent issues where an
> initial response from the community or a Microsoft Support Engineer within
> 2 business day is acceptable. Please note that each follow up response may
> take approximately 2 business days as the support professional working with
> you may need further investigation to reach the most efficient resolution.
> The offering is not appropriate for situations that require urgent,
> real-time or phone-based interactions. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
> ==================================================
>
> --------------------
> | Thread-Topic: AJAX UpdatePanel lost focus
> | thread-index: AcqVLFe77QoByPq0RQOM9yTz7MzwkA==
> | X-WBNR-Posting-Host: 165.189.6.46
> | From: Madison <(E-Mail Removed)>
> | References: <(E-Mail Removed)>
> <(E-Mail Removed)>
> <(E-Mail Removed)>
> <(E-Mail Removed)>
> | Subject: RE: AJAX UpdatePanel lost focus
> | Date: Thu, 14 Jan 2010 07:15:01 -0800
> | Lines: 157
> | Message-ID: <(E-Mail Removed)>
> | MIME-Version: 1.0
> | Content-Type: text/plain;
> | charset="Utf-8"
> | Content-Transfer-Encoding: 7bit
> | X-Newsreader: Microsoft CDO for Windows 2000
> | Content-Class: urn:content-classes:message
> | Importance: normal
> | Priority: normal
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4325
> | Newsgroups: microsoft.public.dotnet.framework.aspnet
> | Path: TK2MSFTNGHUB02.phx.gbl
> | Xref: TK2MSFTNGHUB02.phx.gbl
> microsoft.public.dotnet.framework.aspnet:95775
> | NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
> |
> | Hi Zhi-Qiang Ni,
> |
> | Thank you for your sample codes. I created new page and pasted your
> sample
> | and run. It did not work for me. I still have the same problem when I try
> to
> | enter the values into the textbox.
> |
> |
>
> .
>

 
Reply With Quote
 
Zhi-Qiang Ni[MSFT]
Guest
Posts: n/a
 
      01-18-2010
Hi Madison,

Thanks for your understanding of my supporting. The Ajax does help us
enable the asynchronous post back and partial refresh of the page with less
coding. However, the problem-we cannot stay the cursor in the client side
TextBox after a PostBack - is a default behavior whether we use the
UpdatePanel or not. I have explained the reason of it in my last reply. The
page needs to reload after the first TextBox is on blur. So, it's easy to
focus back to the first TextBox but hard to remember the client side click
of the next TextBox.

You can enjoy the other convenient and useful functions of the ASP.NET AJAX
and AjaxControlToolkit:
http://www.asp.net/ajax/
http://www.asp.net/AJAX/AjaxControlT...s/Default.aspx

--
Sincerely,

Zhi-Qiang Ni

Microsoft Online Support


==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

MSDN Managed Newsgroup support offering is for non-urgent issues where an
initial response from the community or a Microsoft Support Engineer within
2 business day is acceptable. Please note that each follow up response may
take approximately 2 business days as the support professional working with
you may need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations that require urgent,
real-time or phone-based interactions. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
==================================================

--------------------
| Thread-Topic: AJAX UpdatePanel lost focus
| thread-index: AcqV+WwQXiU1Nt3nSCe1ILIw4+BHNg==
| X-WBNR-Posting-Host: 165.189.6.46
| From: Madison <(E-Mail Removed)>
| References: <(E-Mail Removed)>
<(E-Mail Removed)>
<(E-Mail Removed)>
<(E-Mail Removed)>
<(E-Mail Removed)>
<(E-Mail Removed)>
| Subject: RE: AJAX UpdatePanel lost focus
| Date: Fri, 15 Jan 2010 07:43:02 -0800
| Lines: 196
| Message-ID: <(E-Mail Removed)>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4325
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Path: TK2MSFTNGHUB02.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:95795
| NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Hi Zhi-Qiang Ni,
|
| Thank you for your help. Your samples for using the client side give me
the
| idea that I will switch my coding to use javascript for display the total
| check and validation. I still have the server side validation before
saving
| to database. I thought that AJAX will help me with less coding but I
guess
| not. I hope that the new release VS2010 will make the things better.
Thank
| you again for your helps.
|
|

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Triggering an UpdatePanel with a trigger located outside of the UpdatePanel Nathan Sokalski ASP .Net 1 06-15-2009 06:23 PM
How to focus a cell of a gridview inside an UpdatePanel (AJAX) foolmelon@hotmail.com ASP .Net 4 06-18-2008 06:50 PM
refresh an updatePanel in an other updatePanel fran_j_diaz@yahoo.fr ASP .Net 3 08-08-2007 06:30 AM
TextBox Focus Lost when using AJAX UpdatePanel =?Utf-8?B?Qw==?= ASP .Net 0 03-14-2007 02:28 PM
this.window.focus() vs. window.focus() vs. this.focus() Roger Javascript 3 03-08-2007 08:53 PM



Advertisments