T
thatsMaBoy
Hi,
I am attempting to display a simple Javascript alert when a webpage
loads. It works on some pages but not on others. For example, the
following code does not produce an alert:
Code in webpage1 (note, this is the only VB code in the ASPNET
webpage, in other words, the rest is all HTML):
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
Dim str As String = "<script
language=javascript>alert('Hello');</script>"
Page.RegisterStartupScript("Startup", str)
End If
End Sub
However, the same code on a different page produces an alert:
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 EventLog.SourceExists("Building Portal") Then
EventLog.CreateEventSource("Building Portal",
"Application")
End If
EventLog1.Source = "Building Portal"
EventLog1.Log = "Application"
If Page.IsPostBack Then
'make checks to see if the user or email address is
already registered or in process of being registered
Call checkDetails()
Select Case True
Case bEmailExists
lblMessage.Text = "Email already exists! Please
select another"
bDoNotReg = True
Case bUserExists
lblMessage.Text = "Username already exists! Please
select another"
bDoNotReg = True
End Select
End If
End Sub
this page has a lot more VB code...
Please could someone explain why the alert should work on one page but
not the other? Is there some setting that needs setting (I don't
think there is since I haven't actually set one).
Thanks.
Jimmy
I am attempting to display a simple Javascript alert when a webpage
loads. It works on some pages but not on others. For example, the
following code does not produce an alert:
Code in webpage1 (note, this is the only VB code in the ASPNET
webpage, in other words, the rest is all HTML):
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
Dim str As String = "<script
language=javascript>alert('Hello');</script>"
Page.RegisterStartupScript("Startup", str)
End If
End Sub
However, the same code on a different page produces an alert:
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 EventLog.SourceExists("Building Portal") Then
EventLog.CreateEventSource("Building Portal",
"Application")
End If
EventLog1.Source = "Building Portal"
EventLog1.Log = "Application"
If Page.IsPostBack Then
'make checks to see if the user or email address is
already registered or in process of being registered
Call checkDetails()
Select Case True
Case bEmailExists
lblMessage.Text = "Email already exists! Please
select another"
bDoNotReg = True
Case bUserExists
lblMessage.Text = "Username already exists! Please
select another"
bDoNotReg = True
End Select
End If
End Sub
this page has a lot more VB code...
Please could someone explain why the alert should work on one page but
not the other? Is there some setting that needs setting (I don't
think there is since I haven't actually set one).
Thanks.
Jimmy