T
tshad
I have a PageInit.ascx that I want to put in all my pages and have it
execute only once during the "not IsPostback" section. I also need it to
execute first before anything else.
I have it set as:
<%@ Register TagPrefix="fts" TagName="pageInit"
Src="/controls/pageInit.ascx" %>
....
<body>
....
<ftsageInit runat="server"/>
The whole .ascx file is:
************************************************
<script runat="server">
Sub Page_Load(sender as Object, e as EventArgs)
trace.warn("Inside PageInit.ascx")
Dim UserLoggedOn as Label = CType(Page.FindControl("UserLoggedOn"),Label)
Dim UserLoggedOnLabel as Label =
CType(Page.FindControl("UserLoggedOnLabel"),Label)
if not UserLoggedOn is nothing then
if session("LoggedIn") <> nothing then
if session("firstName") <> nothing then
UserLoggedOn.Text = UserLoggedOn.Text & session("firstName")
if session("lastName") <> nothing then
UserLoggedOn.Text = UserLoggedOn.Text & " " & session("lastName")
end if
end if
if not UserLoggedOn is nothing then
UserLoggedOn.visible = true
if not UserLoggedOnLabel is nothing then UserLoggedOnLabel.visible =
true
end if
end if
end if
if not session("User") is nothing then session("LastPageVisited") =
Session("User").LastPageVisited
End Sub
</script>
**************************************************************
This works fine, except that the Page_Load function doesn't run until after
all the Page_Load code has run.
Is there a way to get my control to execute first?
Thanks,
Tom.
execute only once during the "not IsPostback" section. I also need it to
execute first before anything else.
I have it set as:
<%@ Register TagPrefix="fts" TagName="pageInit"
Src="/controls/pageInit.ascx" %>
....
<body>
....
<ftsageInit runat="server"/>
The whole .ascx file is:
************************************************
<script runat="server">
Sub Page_Load(sender as Object, e as EventArgs)
trace.warn("Inside PageInit.ascx")
Dim UserLoggedOn as Label = CType(Page.FindControl("UserLoggedOn"),Label)
Dim UserLoggedOnLabel as Label =
CType(Page.FindControl("UserLoggedOnLabel"),Label)
if not UserLoggedOn is nothing then
if session("LoggedIn") <> nothing then
if session("firstName") <> nothing then
UserLoggedOn.Text = UserLoggedOn.Text & session("firstName")
if session("lastName") <> nothing then
UserLoggedOn.Text = UserLoggedOn.Text & " " & session("lastName")
end if
end if
if not UserLoggedOn is nothing then
UserLoggedOn.visible = true
if not UserLoggedOnLabel is nothing then UserLoggedOnLabel.visible =
true
end if
end if
end if
if not session("User") is nothing then session("LastPageVisited") =
Session("User").LastPageVisited
End Sub
</script>
**************************************************************
This works fine, except that the Page_Load function doesn't run until after
all the Page_Load code has run.
Is there a way to get my control to execute first?
Thanks,
Tom.