-
Page_Load event
I have observed an effect on my aspx pages that I just need to confirm. If I put in my .aspx code-behind file a custom function and after that, the code of my Page_Load event, asp.net ignores my Load event. This way:
Public Function MyFunction() As String
End Function
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
But if I change the position between the two routines, the Load event runs. Is it really mandatory that my Page_Load be the first routine of my page?
Thanks,
Robert
-
I have one Public Function and a few Private Functions and Subs in front of my Page_Load with no problems. Do you have the latest SP (Sp1?) installed.
-
Hi.
Yes. I have installed the SP2 and still have the same effect.
Thanks,
Robert
-
shouldnt make any difference unless you have some code the MyFunction that is causing a problem.
-
Well, I will believe it. I have run into some minor glitches.
VB.NET REPLACE is supposed to return a zero-length string if there is a zero-length string coming in but it returns NOTHING.
Code:
Dim strW As String
strW = " "
strW = Trim(strW)
If strW Is Nothing Then Stop
strW = Replace(strW, " ", "_")
If strW Is Nothing Then Stop '<-- Stops here
-
Hi Robert
ASP.NET is of a event-driven programming model just like what VB6 was.
So, NO where you place your routines doesnt matter which runs first or second.
Check your codes again to make sure or post your codes so that we might be able to help