Hi,
I'm having a problem with some javascript/asp interaction and wonder if someone has a solution or has an explanation for the behavior.

I have a web form with multiple controls and one is TextBox1 with OnBlur attribute executing jscript code to close Panel1 on the form. Normally TextBox1 loses focus when the user tabs-off or clicks on another textbox and the panel is hidden without problem. However, if TextBox1 focus is lost when user clicks a button, Panel1 closes but the postback button event does not execute. My debug statements indicate that no postback occurs. A second click of the button is required to execute the button event. If the OnBlur code is changed to something like clearing a textbox, there is no problem.

I am working in Visual Studio.Net using Asp.Net and Visual Basic.Net in code-behind. I've created a test page with minimum controls to demonstrate this problem and the code is included below. TextBox3 is for displaying passes through the Page_Load routine. Thanks for your time and any help you can offer. - Pat G.

>>>>>>>>>>> TestBlur.aspx code below <<<<<<<<<<<<<<<<<

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="TestBlur.aspx.vb"

Inherits="PGDemographic.TestBlur"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>TestBlur</title>
<meta content="Microsoft Visual Studio.NET 7.0" name=GENERATOR>
<meta content="Visual Basic 7.0" name=CODE_LANGUAGE>
<meta content=JavaScript name=vs_defaultClientScript>
<meta content=http://schemas.microsoft.com/intellisense/ie5 name=vs_targetSchema>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id=frmTestBlur method=post runat="server">

<aspanel id="Panel1" runat="server" BackColor="seashell" Height="40px" Width="100%">
<asp:TextBox id="TextBox0" runat="server" Width="200px"></asp:TextBox>
</aspanel>

<br><br><br>

<asp:textbox id=TextBox1 onblur=
"document.getElementById('TextBox0').value='';
document.getElementById('TextBox1').value=document.getElementById('TextBox1').value+'blur' ;"

runat="server" Width="200px">
</asp:textbox>&nbsp;&nbsp;&nbsp;

<asp:textbox id=TextBox2 onblur="document.getElementById('Panel1').style.display='none';"

runat="server" Width="200px"></asp:textbox>

<br>

<asp:Label id="Label1" width="200px" runat="server">Test Blur with Blank

Text</asp:Label>&nbsp;&nbsp;&nbsp;

<asp:Label id="Label2" Width="200px" runat="server">Test Blur with Hide Panel</asp:Label>

<br><br><br>

<asp:button id=Button1 runat="server" Text="Test Blur" Width="200px"

CausesValidation="False"></asp:button>&nbsp;&nbsp;&nbsp;

<asp:TextBox id="TextBox3" runat="server" Width="145px" Height="140px" MaxLength="500"

TextMode="MultiLine"></asp:TextBox>

</form>

</body>
</HTML>


>>>>>>>>> TestBlur.aspx.vb code below <<<<<<<<<<<<<<<

Public Class TestBlur
Inherits System.Web.UI.Page
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox
Protected WithEvents Panel1 As System.Web.UI.WebControls.Panel
Protected WithEvents TextBox0 As System.Web.UI.WebControls.TextBox
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents Label2 As System.Web.UI.WebControls.Label
Protected WithEvents TextBox3 As System.Web.UI.WebControls.TextBox
Protected WithEvents Button1 As System.Web.UI.WebControls.Button

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs)

Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)

Handles MyBase.Load
'Put user code to initialize the page here

If Not Page.IsPostBack Then
TextBox3.Text = TextBox3.Text & "NotPostBack" & vbCrLf
Else
TextBox3.Text = TextBox3.Text & "PostBack" & vbCrLf
End If

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

Handles Button1.Click

TextBox2.Text = TextBox2.Text & "VBClick"

End Sub

End Class