Hi,
I suggest you put breakpoints in your user contol and in your aspx page
to get an idea of the order in which events are occurring.
Also, it is unclear whether your code is supposed to execute javascript
or c#/vb code.
The location of your <FindSessionUC> tage doesn't determine when code is
executed instead it determines where the rendered code is placed within
the html markup that is output.
To simulate ASP like behaviour (a habit I am also used to) I use the
following at the top of my aspx page:
<!--#Include virtual="~/tools/PageHeader.inc" -->
But even then I know the code will be executed/included after the
PageLoad event.
I think that if you need code routinely executed before the Page_Load
event you are best off writing a new class that inherits
System.Web.UI.Page and then using it for all of your pages. That is
something I also do.
In ASP.NET 2.0 I think something similar can be done with Master pages.
Hope this helps a bit.
mnichols
ed******@yahoo.com wrote:
I am trying to migrate from asp to asp.net and having problem replacing
include with user control.
On every page we have include asp that have some common asp code that I
need to run before the page code kicks in, but user control code is
always running after the page code.
I am even registering and placing user control before my page
initialization, but still it's running after.
<%@Register TagPrefix="FindSessionUC" TagName="FindSession"
Src="EDWFindSessionValues.ascx"%>
<FindSessionUC:FindSession id="MyFindSessionUC" runat="server" />
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="EDW_TEST.aspx.vb" Inherits="CSATodayWEBNet.EDW_TEST"%>
What am I doing wrong?
Any help would be appritiated.
Thanks.