M
Mark Lingen
I've found a problem with postback event handling and webcontrol
buttons. Try out the following code in an ASP.Net project and you
will see. Create a web project in VB.Net and drop this code ontop of
the webform1:
Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
'NOTE: The following placeholder declaration is required by the
Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
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 IsPostBack Then
Me.Label1.Text = "Start..."
Me.TextBox1.Text = ""
End If
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles TextBox1.TextChanged
Me.Label1.Text &= "/Text Box Changed"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
'Response.Redirect("http://www.msn.com")
Me.Label1.Text &= "/Button Clicked"
End Sub
End Class
Results, if the user changes the textbox and then clicks the button
the buttons click event doesn't fire only the textchanged event fires.
My assumption is that both events would fire and the textchanged
event would be first.
Is there a work around to this bug?
Thanks,
Mark Lingen
ICOS Corp
buttons. Try out the following code in an ASP.Net project and you
will see. Create a web project in VB.Net and drop this code ontop of
the webform1:
Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
'NOTE: The following placeholder declaration is required by the
Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
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 IsPostBack Then
Me.Label1.Text = "Start..."
Me.TextBox1.Text = ""
End If
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles TextBox1.TextChanged
Me.Label1.Text &= "/Text Box Changed"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
'Response.Redirect("http://www.msn.com")
Me.Label1.Text &= "/Button Clicked"
End Sub
End Class
Results, if the user changes the textbox and then clicks the button
the buttons click event doesn't fire only the textchanged event fires.
My assumption is that both events would fire and the textchanged
event would be first.
Is there a work around to this bug?
Thanks,
Mark Lingen
ICOS Corp