By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,732 Members | 1,388 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,732 IT Pros & Developers. It's quick & easy.

Page_Load twice

P: n/a
I'm a little rusty having not touched .NET for 6 months and
I can't remember why Page_Load is happening twice in this code:

private void Page_Load(object sender, System.EventArgs e)
{
//existing session?
if (Session["NewOrder"] == null)
{
//save local empty order object
this._newOrder = Orders.Initialize();

//create new in facade
Session["NewOrder"] = this._newOrder;
}

if (!Page.IsPostBack) //bind order items if not posted
this.BindOrderItems();
}

private void BindOrderItems()
{
//if session is active, bind order items to datagrid
if (this.NewOrder != null && this.NewOrder.OrderItems !=
null)
{
OrderItemsGrid.DataSource = this.NewOrder.OrderItems;
OrderItemsGrid.DataBind();
}
}

I know there's a good reason for it but I'm not sure how to
prevent/work around it.

But, anyhow, while stepping through this code, after the
DataGrid is bound (BindOrderItems function) Page_Load
starts over again.

Any ideas?

Thanks!
Nov 19 '05 #1
Share this Question
Share on Google+
14 Replies


P: n/a
This happens to me when the page load is defined in both the HTML and in the
code-behind. Sometimes the IDE will do one thing while I do another to bind
that event.

"V. Jenks" <an*******@discussions.microsoft.com> wrote in message
news:12****************************@phx.gbl...
I'm a little rusty having not touched .NET for 6 months and
I can't remember why Page_Load is happening twice in this code:

private void Page_Load(object sender, System.EventArgs e)
{
//existing session?
if (Session["NewOrder"] == null)
{
//save local empty order object
this._newOrder = Orders.Initialize();

//create new in facade
Session["NewOrder"] = this._newOrder;
}

if (!Page.IsPostBack) //bind order items if not posted
this.BindOrderItems();
}

private void BindOrderItems()
{
//if session is active, bind order items to datagrid
if (this.NewOrder != null && this.NewOrder.OrderItems !=
null)
{
OrderItemsGrid.DataSource = this.NewOrder.OrderItems;
OrderItemsGrid.DataBind();
}
}

I know there's a good reason for it but I'm not sure how to
prevent/work around it.

But, anyhow, while stepping through this code, after the
DataGrid is bound (BindOrderItems function) Page_Load
starts over again.

Any ideas?

Thanks!

Nov 19 '05 #2

P: n/a
In the html of your aspx, check to see if you have "AutoEventWireup=False"
or not. If you are using code-behind, you need to have this attribute set to
false
--
Kumar Reddi
http://kumarreddi.blogspot.com

"V. Jenks" <an*******@discussions.microsoft.com> wrote in message
news:12****************************@phx.gbl...
I'm a little rusty having not touched .NET for 6 months and
I can't remember why Page_Load is happening twice in this code:

private void Page_Load(object sender, System.EventArgs e)
{
//existing session?
if (Session["NewOrder"] == null)
{
//save local empty order object
this._newOrder = Orders.Initialize();

//create new in facade
Session["NewOrder"] = this._newOrder;
}

if (!Page.IsPostBack) //bind order items if not posted
this.BindOrderItems();
}

private void BindOrderItems()
{
//if session is active, bind order items to datagrid
if (this.NewOrder != null && this.NewOrder.OrderItems !=
null)
{
OrderItemsGrid.DataSource = this.NewOrder.OrderItems;
OrderItemsGrid.DataBind();
}
}

I know there's a good reason for it but I'm not sure how to
prevent/work around it.

But, anyhow, while stepping through this code, after the
DataGrid is bound (BindOrderItems function) Page_Load
starts over again.

Any ideas?

Thanks!

Nov 19 '05 #3

P: n/a
It's definitely not, this is inside of a web user control,
sorry I should have mentioned that.

I know the Page_Load event handler from the master page is
loading but that's not what I'm seeing. The Page_Load in
the user control that I'm stepping through fires twice. It
is not defined twice as I'm stepping through it in the
debugger and I'm watching it do it twice.

Also, the control that this is happening in is being loaded
by a Page.LoadControl (asp:placeholder) in the master page.

Still, this shouldn't happen.

-----Original Message-----
I'm a little rusty having not touched .NET for 6 months and
I can't remember why Page_Load is happening twice in this code:
private void Page_Load(object sender, System.EventArgs e)
{
//existing session?
if (Session["NewOrder"] == null)
{
//save local empty order object
this._newOrder = Orders.Initialize();

//create new in facade
Session["NewOrder"] = this._newOrder;
}

if (!Page.IsPostBack) //bind order items if not posted
this.BindOrderItems();
}

private void BindOrderItems()
{
//if session is active, bind order items to datagrid
if (this.NewOrder != null && this.NewOrder.OrderItems !=
null)
{
OrderItemsGrid.DataSource = this.NewOrder.OrderItems;
OrderItemsGrid.DataBind();
}
}

I know there's a good reason for it but I'm not sure how to
prevent/work around it.

But, anyhow, while stepping through this code, after the
DataGrid is bound (BindOrderItems function) Page_Load
starts over again.

Any ideas?

Thanks!
.

Nov 19 '05 #4

P: n/a
Hi,

Are you using an master page type architecture? The kind where you have 1
..aspx page that holds the layout and common features and then a bunch of
..ascx pages that are loaded into a place holder for content? If so you
might have some code in your Globabl.asax file that is causing this to
happen. Just a wild guess, but when I was using that architecture on a
project I had that happen. Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"V. Jenks" <an*******@discussions.microsoft.com> wrote in message
news:13****************************@phx.gbl...
It's definitely not, this is inside of a web user control,
sorry I should have mentioned that.

I know the Page_Load event handler from the master page is
loading but that's not what I'm seeing. The Page_Load in
the user control that I'm stepping through fires twice. It
is not defined twice as I'm stepping through it in the
debugger and I'm watching it do it twice.

Also, the control that this is happening in is being loaded
by a Page.LoadControl (asp:placeholder) in the master page.

Still, this shouldn't happen.

-----Original Message-----
I'm a little rusty having not touched .NET for 6 months and
I can't remember why Page_Load is happening twice in this

code:

private void Page_Load(object sender, System.EventArgs e)
{
//existing session?
if (Session["NewOrder"] == null)
{
//save local empty order object
this._newOrder = Orders.Initialize();

//create new in facade
Session["NewOrder"] = this._newOrder;
}

if (!Page.IsPostBack) //bind order items if not posted
this.BindOrderItems();
}

private void BindOrderItems()
{
//if session is active, bind order items to datagrid
if (this.NewOrder != null && this.NewOrder.OrderItems !=
null)
{
OrderItemsGrid.DataSource = this.NewOrder.OrderItems;
OrderItemsGrid.DataBind();
}
}

I know there's a good reason for it but I'm not sure how to
prevent/work around it.

But, anyhow, while stepping through this code, after the
DataGrid is bound (BindOrderItems function) Page_Load
starts over again.

Any ideas?

Thanks!
.

Nov 19 '05 #5

P: n/a
Is the page getting posted back ?
Any Postback will trigger Page_Load again.

Try turning on Trace for the page, and look at the trace
log to see exactly what is making Page_Load fire twice.

You're using C#, so the Page directive will be :

<%@ Page Language="C#" Trace="true" %>
( plus any other directives you have for that page )

Juan T. Llibre
===========
"V. Jenks" <an*******@discussions.microsoft.com> wrote in message
news:13****************************@phx.gbl...
It's definitely not, this is inside of a web user control,
sorry I should have mentioned that.

I know the Page_Load event handler from the master page is
loading but that's not what I'm seeing. The Page_Load in
the user control that I'm stepping through fires twice. It
is not defined twice as I'm stepping through it in the
debugger and I'm watching it do it twice.

Also, the control that this is happening in is being loaded
by a Page.LoadControl (asp:placeholder) in the master page.

Still, this shouldn't happen.


-----Original Message-----
I'm a little rusty having not touched .NET for 6 months and
I can't remember why Page_Load is happening twice in this

code:

private void Page_Load(object sender, System.EventArgs e)
{
//existing session?
if (Session["NewOrder"] == null)
{
//save local empty order object
this._newOrder = Orders.Initialize();

//create new in facade
Session["NewOrder"] = this._newOrder;
}

if (!Page.IsPostBack) //bind order items if not posted
this.BindOrderItems();
}

private void BindOrderItems()
{
//if session is active, bind order items to datagrid
if (this.NewOrder != null && this.NewOrder.OrderItems !=
null)
{
OrderItemsGrid.DataSource = this.NewOrder.OrderItems;
OrderItemsGrid.DataBind();
}
}

I know there's a good reason for it but I'm not sure how to
prevent/work around it.

But, anyhow, while stepping through this code, after the
DataGrid is bound (BindOrderItems function) Page_Load
starts over again.

Any ideas?

Thanks!
.

Nov 19 '05 #6

P: n/a
Yes, each "section" of my application consists of a master
page with a bunch of dynamically loaded ascx controls based
on user-interaction and other factors.

There isn't anything exotic in my Global.asax, as far as I
know. The only thing is in the Session_Start event
handler, which loads a simple Hashtable into a session
variable, that's it, that's all!

Now my control event handlers aren't getting fired, it's
acting really strange!

-v
-----Original Message-----
Hi,

Are you using an master page type architecture? The kind where you have 1..aspx page that holds the layout and common features and then a bunch of..ascx pages that are loaded into a place holder for content? If so youmight have some code in your Globabl.asax file that is causing this tohappen. Just a wild guess, but when I was using that architecture on aproject I had that happen. Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"V. Jenks" <an*******@discussions.microsoft.com> wrote in messagenews:13****************************@phx.gbl...
It's definitely not, this is inside of a web user control,
sorry I should have mentioned that.

I know the Page_Load event handler from the master page is
loading but that's not what I'm seeing. The Page_Load in
the user control that I'm stepping through fires twice. It
is not defined twice as I'm stepping through it in the
debugger and I'm watching it do it twice.

Also, the control that this is happening in is being loaded
by a Page.LoadControl (asp:placeholder) in the master page.

Still, this shouldn't happen.

>-----Original Message-----
>I'm a little rusty having not touched .NET for 6 months and
>I can't remember why Page_Load is happening twice in this

code:
>
> private void Page_Load(object sender, System.EventArgs e)
> {
> //existing session?
> if (Session["NewOrder"] == null)
> {
> //save local empty order object
> this._newOrder = Orders.Initialize();
>
> //create new in facade
> Session["NewOrder"] = this._newOrder;
> }
>
> if (!Page.IsPostBack) //bind order items if not posted
> this.BindOrderItems();
> }
>
> private void BindOrderItems()
> {
> //if session is active, bind order items to datagrid
> if (this.NewOrder != null && this.NewOrder.OrderItems !=
>null)
> {
> OrderItemsGrid.DataSource = this.NewOrder.OrderItems;
> OrderItemsGrid.DataBind();
> }
> }
>
>I know there's a good reason for it but I'm not sure how to
>prevent/work around it.
>
>But, anyhow, while stepping through this code, after the
>DataGrid is bound (BindOrderItems function) Page_Load
>starts over again.
>
>Any ideas?
>
>Thanks!
>.
>

.

Nov 19 '05 #7

P: n/a
Hi,

A lot of times those systems use the Application_BeginRequest() subroutine
in the Global.asax to do a Context.RewritePath(). Also you might want to
make sure that your section master pages aren't named the same. For example
they might all be named Default.aspx but in different folders. Other than
that all I can recommend is to watch the tracing of your app as it runs. I
mean if your page_load runs and then ends and then runs again something in
between is happening because the page_load isn't calling itself. The trace
information should at least tell you where your app is going before it comes
back. Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

<an*******@discussions.microsoft.com> wrote in message
news:14****************************@phx.gbl...
Yes, each "section" of my application consists of a master
page with a bunch of dynamically loaded ascx controls based
on user-interaction and other factors.

There isn't anything exotic in my Global.asax, as far as I
know. The only thing is in the Session_Start event
handler, which loads a simple Hashtable into a session
variable, that's it, that's all!

Now my control event handlers aren't getting fired, it's
acting really strange!

-v
-----Original Message-----
Hi,

Are you using an master page type architecture? The kind

where you have 1
..aspx page that holds the layout and common features and

then a bunch of
..ascx pages that are loaded into a place holder for

content? If so you
might have some code in your Globabl.asax file that is

causing this to
happen. Just a wild guess, but when I was using that

architecture on a
project I had that happen. Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"V. Jenks" <an*******@discussions.microsoft.com> wrote in

message
news:13****************************@phx.gbl...
It's definitely not, this is inside of a web user control,
sorry I should have mentioned that.

I know the Page_Load event handler from the master page is
loading but that's not what I'm seeing. The Page_Load in
the user control that I'm stepping through fires twice. It
is not defined twice as I'm stepping through it in the
debugger and I'm watching it do it twice.

Also, the control that this is happening in is being loaded
by a Page.LoadControl (asp:placeholder) in the master page.

Still, this shouldn't happen.
>-----Original Message-----
>I'm a little rusty having not touched .NET for 6 months and
>I can't remember why Page_Load is happening twice in this
code:
>
> private void Page_Load(object sender, System.EventArgs e)
> {
> //existing session?
> if (Session["NewOrder"] == null)
> {
> //save local empty order object
> this._newOrder = Orders.Initialize();
>
> //create new in facade
> Session["NewOrder"] = this._newOrder;
> }
>
> if (!Page.IsPostBack) //bind order items if not posted
> this.BindOrderItems();
> }
>
> private void BindOrderItems()
> {
> //if session is active, bind order items to datagrid
> if (this.NewOrder != null && this.NewOrder.OrderItems !=
>null)
> {
> OrderItemsGrid.DataSource = this.NewOrder.OrderItems;
> OrderItemsGrid.DataBind();
> }
> }
>
>I know there's a good reason for it but I'm not sure how to
>prevent/work around it.
>
>But, anyhow, while stepping through this code, after the
>DataGrid is bound (BindOrderItems function) Page_Load
>starts over again.
>
>Any ideas?
>
>Thanks!
>.
>

.

Nov 19 '05 #8

P: n/a
If it'll help, here's some code from the page/control where
this is happening (from another msg. I posted somewhere else):

Everyone's first reaction to this is "You have
autoeventwireup set to 'true'", I assure you this isn't the
case.

I'm completely stumped and I can't figure out why it's
firing twice!?

The master (aspx) page which contains a User Control (ascx)
- it is loaded dynamically through an asp:placeholder in
the master page.

Here's my master page:

//BEGIN CODE ---------------------------

<%@ Page language="c#" Codebehind="pos.aspx.cs"
AutoEventWireup="false" Inherits="Scientifik.Fusion.pos" %>
<%@ Register Tagprefix="sci" Tagname="posnav"
src="~/global/controls/nav/pos_nav.ascx" %>
<%@ Register Tagprefix="sci" Tagname="mainheader"
src="~/global/controls/header/main_header.ascx" %>
<%@ Register Tagprefix="sci" Tagname="mainfooter"
src="~/global/controls/footer/main_footer.ascx" %>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title>Scientifik Solutions</title>
<script language="javascript"
src="global/scripts/rollover.js"></script>
<link rel="stylesheet" type="text/css"
href="global/css/fusion_main.css">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0"
marginwidth="0" marginheight="0" onload="preloadImages();">
<table width="100%" height="100%" border="0"
cellpadding="0" cellspacing="0">
<tr>
<td width="100%" colspan="3" valign="top">
<sci:mainheader id="MainHeader" runat="server" />
</td>
</tr>
<tr>
<td width="24" height="44" valign="top">
<img src="images/pos_nav_leftgap.gif" width="24" /></td>
<td width="165" height="154" valign="top"
background="images/comp_1_13.gif">
<!-- begin navigation -->
<sci:posnav id="PosNav" runat="server" />
<!-- end navigation -->
</td>
<td width="100%" height="100%" valign="top" rowspan="2">
<form id="MainForm" name="MainForm" method="post"
runat="server">
<!-- begin body -->
<asp:placeholder id="BodyPlaceholder" runat="server" />
<!-- end body -->
</form>
</td>
</tr>
<tr>
<td width="24" height="100%" valign="top">&nbsp;</td>
<td width="165" height="100%" valign="top"
background="images/comp_1_13.gif">
&nbsp;
</td>
</tr>
<tr>
<td width="100%" colspan="3">
<sci:mainfooter id="MainFooter" runat="server" />
</td>
</tr>
</table>
</body>
</html>

//END CODE ---------------------------

Now, here's the control that is being loaded. It works
*fine* other than when I step through the code-behind,
Page_Load is fired twice and it is causing a number of
problems elsewhere in my code, making for a real headache:

//BEGIN CODE ---------------------------

<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="terminal.ascx.cs"
Inherits="Scientifik.Fusion.Pos.terminal"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<table width="100%" border="0" cellpadding="3" cellspacing="0">
<tr>
<td width="1%" bgcolor="#f1efe2">&nbsp;</td>
<td width="99%" bgcolor="#f1efe2">
<span class="bodyTitle">
Scientifik Fusion ::. Point-of-Sale - New Contact/Order
</span>
</td>
</tr>
</table>
<br />
<table width="100%" border="0" cellpadding="3" cellspacing="3">
<tr>
<td>&nbsp;</td>
<td class="genTitle" colspan="2">
<table border="0" width="100%" cellpadding="3"
cellspacing="3">
<tr>
<td rowspan="2" width="5%">
<img src="images/cashregister.gif" width="32"
height="32" />
</td>
<td class="genTitle" width="95%">
Process New Order &amp; Contact
</td>
</tr>
<tr>
<td class="genBody" width="95%">
Complete the form below to process an order and add a
new contact.
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="genBody" colspan="2">
<table width="100%" border="0" cellpadding="3"
cellspacing="3">
<tr>
<td>
---- THE CONTENTS
HAVE BEEN OMMITTED FOR BREVITY ----
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="3">
&nbsp;
</td>
</tr>
</table>

//END CODE ---------------------------

There's nothing exotic about the user control or the page
itself, it should be really straightforward. Not that it
would offer any clues but here's my Page_Load event in the
code-behind:

//BEGIN CODE ---------------------------

private void Page_Load(object sender, System.EventArgs e)
{
//existing session?
if (Session["NewOrder"] == null)
{
//save local empty order object
this._newOrder = Orders.Initialize();

//create new in facade
Session["NewOrder"] = this._newOrder;
}

if (!Page.IsPostBack) //bind order items if not posted
{
//hide options list
OIProdOptionList.Visible = false;

//bind before post-back
this.BindOrderItems();

//load products and options into sessions
this.LoadAllProductsAndOptions();
}
}

//END CODE ---------------------------

-v

-----Original Message-----
It's definitely not, this is inside of a web user control,
sorry I should have mentioned that.

I know the Page_Load event handler from the master page is
loading but that's not what I'm seeing. The Page_Load in
the user control that I'm stepping through fires twice. It
is not defined twice as I'm stepping through it in the
debugger and I'm watching it do it twice.

Also, the control that this is happening in is being loaded
by a Page.LoadControl (asp:placeholder) in the master page.

Still, this shouldn't happen.

-----Original Message-----
I'm a little rusty having not touched .NET for 6 months and
I can't remember why Page_Load is happening twice in this

code:

private void Page_Load(object sender, System.EventArgs e)
{
//existing session?
if (Session["NewOrder"] == null)
{
//save local empty order object
this._newOrder = Orders.Initialize();

//create new in facade
Session["NewOrder"] = this._newOrder;
}

if (!Page.IsPostBack) //bind order items if not posted
this.BindOrderItems();
}

private void BindOrderItems()
{
//if session is active, bind order items to datagrid
if (this.NewOrder != null && this.NewOrder.OrderItems !=
null)
{
OrderItemsGrid.DataSource = this.NewOrder.OrderItems;
OrderItemsGrid.DataBind();
}
}

I know there's a good reason for it but I'm not sure how to
prevent/work around it.

But, anyhow, while stepping through this code, after the
DataGrid is bound (BindOrderItems function) Page_Load
starts over again.

Any ideas?

Thanks!
.

.

Nov 19 '05 #9

P: n/a
The Page_Load that is being fired twice, is it in the .ascx file or in the
master .aspx file? Ken.

"V. Jenks" <an*******@discussions.microsoft.com> wrote in message
news:17****************************@phx.gbl...
If it'll help, here's some code from the page/control where
this is happening (from another msg. I posted somewhere else):

Everyone's first reaction to this is "You have
autoeventwireup set to 'true'", I assure you this isn't the
case.

I'm completely stumped and I can't figure out why it's
firing twice!?

The master (aspx) page which contains a User Control (ascx)
- it is loaded dynamically through an asp:placeholder in
the master page.

Here's my master page:

//BEGIN CODE ---------------------------

<%@ Page language="c#" Codebehind="pos.aspx.cs"
AutoEventWireup="false" Inherits="Scientifik.Fusion.pos" %>
<%@ Register Tagprefix="sci" Tagname="posnav"
src="~/global/controls/nav/pos_nav.ascx" %>
<%@ Register Tagprefix="sci" Tagname="mainheader"
src="~/global/controls/header/main_header.ascx" %>
<%@ Register Tagprefix="sci" Tagname="mainfooter"
src="~/global/controls/footer/main_footer.ascx" %>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title>Scientifik Solutions</title>
<script language="javascript"
src="global/scripts/rollover.js"></script>
<link rel="stylesheet" type="text/css"
href="global/css/fusion_main.css">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0"
marginwidth="0" marginheight="0" onload="preloadImages();">
<table width="100%" height="100%" border="0"
cellpadding="0" cellspacing="0">
<tr>
<td width="100%" colspan="3" valign="top">
<sci:mainheader id="MainHeader" runat="server" />
</td>
</tr>
<tr>
<td width="24" height="44" valign="top">
<img src="images/pos_nav_leftgap.gif" width="24" /></td>
<td width="165" height="154" valign="top"
background="images/comp_1_13.gif">
<!-- begin navigation -->
<sci:posnav id="PosNav" runat="server" />
<!-- end navigation -->
</td>
<td width="100%" height="100%" valign="top" rowspan="2">
<form id="MainForm" name="MainForm" method="post"
runat="server">
<!-- begin body -->
<asp:placeholder id="BodyPlaceholder" runat="server" />
<!-- end body -->
</form>
</td>
</tr>
<tr>
<td width="24" height="100%" valign="top">&nbsp;</td>
<td width="165" height="100%" valign="top"
background="images/comp_1_13.gif">
&nbsp;
</td>
</tr>
<tr>
<td width="100%" colspan="3">
<sci:mainfooter id="MainFooter" runat="server" />
</td>
</tr>
</table>
</body>
</html>

//END CODE ---------------------------

Now, here's the control that is being loaded. It works
*fine* other than when I step through the code-behind,
Page_Load is fired twice and it is causing a number of
problems elsewhere in my code, making for a real headache:

//BEGIN CODE ---------------------------

<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="terminal.ascx.cs"
Inherits="Scientifik.Fusion.Pos.terminal"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<table width="100%" border="0" cellpadding="3" cellspacing="0">
<tr>
<td width="1%" bgcolor="#f1efe2">&nbsp;</td>
<td width="99%" bgcolor="#f1efe2">
<span class="bodyTitle">
Scientifik Fusion ::. Point-of-Sale - New Contact/Order
</span>
</td>
</tr>
</table>
<br />
<table width="100%" border="0" cellpadding="3" cellspacing="3">
<tr>
<td>&nbsp;</td>
<td class="genTitle" colspan="2">
<table border="0" width="100%" cellpadding="3"
cellspacing="3">
<tr>
<td rowspan="2" width="5%">
<img src="images/cashregister.gif" width="32"
height="32" />
</td>
<td class="genTitle" width="95%">
Process New Order &amp; Contact
</td>
</tr>
<tr>
<td class="genBody" width="95%">
Complete the form below to process an order and add a
new contact.
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="genBody" colspan="2">
<table width="100%" border="0" cellpadding="3"
cellspacing="3">
<tr>
<td>
---- THE CONTENTS
HAVE BEEN OMMITTED FOR BREVITY ----
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="3">
&nbsp;
</td>
</tr>
</table>

//END CODE ---------------------------

There's nothing exotic about the user control or the page
itself, it should be really straightforward. Not that it
would offer any clues but here's my Page_Load event in the
code-behind:

//BEGIN CODE ---------------------------

private void Page_Load(object sender, System.EventArgs e)
{
//existing session?
if (Session["NewOrder"] == null)
{
//save local empty order object
this._newOrder = Orders.Initialize();

//create new in facade
Session["NewOrder"] = this._newOrder;
}

if (!Page.IsPostBack) //bind order items if not posted
{
//hide options list
OIProdOptionList.Visible = false;

//bind before post-back
this.BindOrderItems();

//load products and options into sessions
this.LoadAllProductsAndOptions();
}
}

//END CODE ---------------------------

-v

-----Original Message-----
It's definitely not, this is inside of a web user control,
sorry I should have mentioned that.

I know the Page_Load event handler from the master page is
loading but that's not what I'm seeing. The Page_Load in
the user control that I'm stepping through fires twice. It
is not defined twice as I'm stepping through it in the
debugger and I'm watching it do it twice.

Also, the control that this is happening in is being loaded
by a Page.LoadControl (asp:placeholder) in the master page.

Still, this shouldn't happen.

-----Original Message-----
I'm a little rusty having not touched .NET for 6 months and
I can't remember why Page_Load is happening twice in this

code:

private void Page_Load(object sender, System.EventArgs e)
{
//existing session?
if (Session["NewOrder"] == null)
{
//save local empty order object
this._newOrder = Orders.Initialize();

//create new in facade
Session["NewOrder"] = this._newOrder;
}

if (!Page.IsPostBack) //bind order items if not posted
this.BindOrderItems();
}

private void BindOrderItems()
{
//if session is active, bind order items to datagrid
if (this.NewOrder != null && this.NewOrder.OrderItems !=
null)
{
OrderItemsGrid.DataSource = this.NewOrder.OrderItems;
OrderItemsGrid.DataBind();
}
}

I know there's a good reason for it but I'm not sure how to
prevent/work around it.

But, anyhow, while stepping through this code, after the
DataGrid is bound (BindOrderItems function) Page_Load
starts over again.

Any ideas?

Thanks!
.

.

Nov 19 '05 #10

P: n/a
Actually, I forgot to mention one important detail. Each
of my "master" pages inherits from a custom class I wrote,
which itself derives from System.Web.UI.Page.

So, for example, here's my custom PageBase class:

//CODE

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace Scientifik.Fusion
{
/// <summary>
/// Base page class for all main application aspx pages.
/// </summary>
public class PageBase : System.Web.UI.Page
{

public PageBase()
{
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, System.EventArgs e)
{
//I would load the placeholder control here
}
}
}

//END CODE

And here would be the code-behind for a "master page":

//CODE

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace Scientifik.Fusion
{
/// <summary>
/// </summary>
public class pos : PageBase
{
public pos()
{
//default constructor would pass string values to base
class (PageBase)
//which tell the page-loader what to load
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web
Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}

//END CODE

Lo and behold, when stepping through the code, it's
PageBase that's doing Page_Load twice, not the control, it
completely slipped my mind!

Any ideas?

-v
-----Original Message-----
Hi,

A lot of times those systems use the Application_BeginRequest() subroutinein the Global.asax to do a Context.RewritePath(). Also you might want tomake sure that your section master pages aren't named the same. For examplethey might all be named Default.aspx but in different folders. Other thanthat all I can recommend is to watch the tracing of your app as it runs. Imean if your page_load runs and then ends and then runs again something inbetween is happening because the page_load isn't calling itself. The traceinformation should at least tell you where your app is going before it comesback. Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

<an*******@discussions.microsoft.com> wrote in message
news:14****************************@phx.gbl...
Yes, each "section" of my application consists of a master
page with a bunch of dynamically loaded ascx controls based
on user-interaction and other factors.

There isn't anything exotic in my Global.asax, as far as I
know. The only thing is in the Session_Start event
handler, which loads a simple Hashtable into a session
variable, that's it, that's all!

Now my control event handlers aren't getting fired, it's
acting really strange!

-v
>-----Original Message-----
>Hi,
>
>Are you using an master page type architecture? The kind

where you have 1
>..aspx page that holds the layout and common features and

then a bunch of
>..ascx pages that are loaded into a place holder for

content? If so you
>might have some code in your Globabl.asax file that is

causing this to
>happen. Just a wild guess, but when I was using that

architecture on a
>project I had that happen. Good luck! Ken.
>
>--
>Ken Dopierala Jr.
>For great ASP.Net web hosting try:
>http://www.webhost4life.com/default.asp?refid=Spinlight
>If you sign up under me and need help, email me.
>
>"V. Jenks" <an*******@discussions.microsoft.com> wrote in

message
>news:13****************************@phx.gbl...
>> It's definitely not, this is inside of a web user control, >> sorry I should have mentioned that.
>>
>> I know the Page_Load event handler from the master page is >> loading but that's not what I'm seeing. The Page_Load in
>> the user control that I'm stepping through fires twice. It >> is not defined twice as I'm stepping through it in the
>> debugger and I'm watching it do it twice.
>>
>> Also, the control that this is happening in is being loaded >> by a Page.LoadControl (asp:placeholder) in the master page. >>
>> Still, this shouldn't happen.
>>
>>
>> >-----Original Message-----
>> >I'm a little rusty having not touched .NET for 6 months and >> >I can't remember why Page_Load is happening twice in this >> code:
>> >
>> > private void Page_Load(object sender, System.EventArgs e) >> > {
>> > //existing session?
>> > if (Session["NewOrder"] == null)
>> > {
>> > //save local empty order object
>> > this._newOrder = Orders.Initialize();
>> >
>> > //create new in facade
>> > Session["NewOrder"] = this._newOrder;
>> > }
>> >
>> > if (!Page.IsPostBack) //bind order items if not posted
>> > this.BindOrderItems();
>> > }
>> >
>> > private void BindOrderItems()
>> > {
>> > //if session is active, bind order items to datagrid
>> > if (this.NewOrder != null && this.NewOrder.OrderItems != >> >null)
>> > {
>> > OrderItemsGrid.DataSource = this.NewOrder.OrderItems;
>> > OrderItemsGrid.DataBind();
>> > }
>> > }
>> >
>> >I know there's a good reason for it but I'm not sure how to >> >prevent/work around it.
>> >
>> >But, anyhow, while stepping through this code, after the
>> >DataGrid is bound (BindOrderItems function) Page_Load
>> >starts over again.
>> >
>> >Any ideas?
>> >
>> >Thanks!
>> >.
>> >
>
>
>.
>

.

Nov 19 '05 #11

P: n/a
Yeah I tried this, it is not being posted. It's loading
w/o any type of post happening but still doing it twice.
-----Original Message-----
Is the page getting posted back ?
Any Postback will trigger Page_Load again.

Try turning on Trace for the page, and look at the trace
log to see exactly what is making Page_Load fire twice.

You're using C#, so the Page directive will be :

<%@ Page Language="C#" Trace="true" %>
( plus any other directives you have for that page )

Juan T. Llibre
===========
"V. Jenks" <an*******@discussions.microsoft.com> wrote in messagenews:13****************************@phx.gbl...
It's definitely not, this is inside of a web user control,
sorry I should have mentioned that.

I know the Page_Load event handler from the master page is
loading but that's not what I'm seeing. The Page_Load in
the user control that I'm stepping through fires twice. It
is not defined twice as I'm stepping through it in the
debugger and I'm watching it do it twice.

Also, the control that this is happening in is being loaded
by a Page.LoadControl (asp:placeholder) in the master page.

Still, this shouldn't happen.


-----Original Message-----
I'm a little rusty having not touched .NET for 6 months and
I can't remember why Page_Load is happening twice in this

code:

private void Page_Load(object sender, System.EventArgs e)
{
//existing session?
if (Session["NewOrder"] == null)
{
//save local empty order object
this._newOrder = Orders.Initialize();

//create new in facade
Session["NewOrder"] = this._newOrder;
}

if (!Page.IsPostBack) //bind order items if not posted
this.BindOrderItems();
}

private void BindOrderItems()
{
//if session is active, bind order items to datagrid
if (this.NewOrder != null && this.NewOrder.OrderItems !=
null)
{
OrderItemsGrid.DataSource = this.NewOrder.OrderItems;
OrderItemsGrid.DataBind();
}
}

I know there's a good reason for it but I'm not sure how to
prevent/work around it.

But, anyhow, while stepping through this code, after the
DataGrid is bound (BindOrderItems function) Page_Load
starts over again.

Any ideas?

Thanks!
.

.

Nov 19 '05 #12

P: n/a
At
http://www.mcse.ms/archive109-2003-12-207567.html

Colin reports that removing this line :

this.Load += new System.EventHandler(this.PageLoadEvent);
fixed the same problem you're having.

Rick Strahl [MVP] turned him on to this reasoning :

---000---
Check the setting of AutoEventHookup on the page. If you're
using CodeBehind pages you generally don't want this as the
CodeBehind page automatically generates the OnLoad() event hookup.

Also if your form is inherited and your event hookups in the
base class (in InitializeComponent) you will end up hooking
the eventhandler multiple times and so it fires more than once.

The solution there is to remove the OnLoad code
manually in the implementation level of the form.
---000---

Let us know if this works.

Good luck!

Juan T. Llibre
===========
"V. Jenks" <an*******@discussions.microsoft.com> wrote in message
news:30****************************@phx.gbl...
Actually, I forgot to mention one important detail. Each
of my "master" pages inherits from a custom class I wrote,
which itself derives from System.Web.UI.Page.

So, for example, here's my custom PageBase class:

//CODE

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace Scientifik.Fusion
{
/// <summary>
/// Base page class for all main application aspx pages.
/// </summary>
public class PageBase : System.Web.UI.Page
{

public PageBase()
{
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, System.EventArgs e)
{
//I would load the placeholder control here
}
}
}

//END CODE

And here would be the code-behind for a "master page":

//CODE

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace Scientifik.Fusion
{
/// <summary>
/// </summary>
public class pos : PageBase
{
public pos()
{
//default constructor would pass string values to base
class (PageBase)
//which tell the page-loader what to load
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web
Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}

//END CODE

Lo and behold, when stepping through the code, it's
PageBase that's doing Page_Load twice, not the control, it
completely slipped my mind!

Any ideas?

-v
-----Original Message-----
Hi,

A lot of times those systems use the

Application_BeginRequest() subroutine
in the Global.asax to do a Context.RewritePath(). Also

you might want to
make sure that your section master pages aren't named the

same. For example
they might all be named Default.aspx but in different

folders. Other than
that all I can recommend is to watch the tracing of your

app as it runs. I
mean if your page_load runs and then ends and then runs

again something in
between is happening because the page_load isn't calling

itself. The trace
information should at least tell you where your app is

going before it comes
back. Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

<an*******@discussions.microsoft.com> wrote in message
news:14****************************@phx.gbl...
Yes, each "section" of my application consists of a master
page with a bunch of dynamically loaded ascx controls based
on user-interaction and other factors.

There isn't anything exotic in my Global.asax, as far as I
know. The only thing is in the Session_Start event
handler, which loads a simple Hashtable into a session
variable, that's it, that's all!

Now my control event handlers aren't getting fired, it's
acting really strange!

-v

>-----Original Message-----
>Hi,
>
>Are you using an master page type architecture? The kind
where you have 1
>..aspx page that holds the layout and common features and
then a bunch of
>..ascx pages that are loaded into a place holder for
content? If so you
>might have some code in your Globabl.asax file that is
causing this to
>happen. Just a wild guess, but when I was using that
architecture on a
>project I had that happen. Good luck! Ken.
>
>--
>Ken Dopierala Jr.
>For great ASP.Net web hosting try:
>http://www.webhost4life.com/default.asp?refid=Spinlight
>If you sign up under me and need help, email me.
>
>"V. Jenks" <an*******@discussions.microsoft.com> wrote in
message
>news:13****************************@phx.gbl...
>> It's definitely not, this is inside of a web user control, >> sorry I should have mentioned that.
>>
>> I know the Page_Load event handler from the master page is >> loading but that's not what I'm seeing. The Page_Load in
>> the user control that I'm stepping through fires twice. It >> is not defined twice as I'm stepping through it in the
>> debugger and I'm watching it do it twice.
>>
>> Also, the control that this is happening in is being loaded >> by a Page.LoadControl (asp:placeholder) in the master page. >>
>> Still, this shouldn't happen.
>>
>>
>> >-----Original Message-----
>> >I'm a little rusty having not touched .NET for 6 months and >> >I can't remember why Page_Load is happening twice in this >> code:
>> >
>> > private void Page_Load(object sender, System.EventArgs e) >> > {
>> > //existing session?
>> > if (Session["NewOrder"] == null)
>> > {
>> > //save local empty order object
>> > this._newOrder = Orders.Initialize();
>> >
>> > //create new in facade
>> > Session["NewOrder"] = this._newOrder;
>> > }
>> >
>> > if (!Page.IsPostBack) //bind order items if not posted
>> > this.BindOrderItems();
>> > }
>> >
>> > private void BindOrderItems()
>> > {
>> > //if session is active, bind order items to datagrid
>> > if (this.NewOrder != null && this.NewOrder.OrderItems != >> >null)
>> > {
>> > OrderItemsGrid.DataSource = this.NewOrder.OrderItems;
>> > OrderItemsGrid.DataBind();
>> > }
>> > }
>> >
>> >I know there's a good reason for it but I'm not sure how to >> >prevent/work around it.
>> >
>> >But, anyhow, while stepping through this code, after the
>> >DataGrid is bound (BindOrderItems function) Page_Load
>> >starts over again.
>> >
>> >Any ideas?
>> >
>> >Thanks!
>> >.
>> >
>
>
>.
>

.

Nov 19 '05 #13

P: n/a
I've been watching tracing and suprisingly, nothing looks
out of place at all.

The expected events are happening (Init, PreRender,
SaveViewState, Render).

Each of the page controls being loaded are exactly as
expected, looks good there.

It's a GET request, so the form hasn't been posted w/o my
knowledge.

???

-----Original Message-----
Hi,

A lot of times those systems use the Application_BeginRequest() subroutinein the Global.asax to do a Context.RewritePath(). Also you might want tomake sure that your section master pages aren't named the same. For examplethey might all be named Default.aspx but in different folders. Other thanthat all I can recommend is to watch the tracing of your app as it runs. Imean if your page_load runs and then ends and then runs again something inbetween is happening because the page_load isn't calling itself. The traceinformation should at least tell you where your app is going before it comesback. Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

<an*******@discussions.microsoft.com> wrote in message
news:14****************************@phx.gbl...
Yes, each "section" of my application consists of a master
page with a bunch of dynamically loaded ascx controls based
on user-interaction and other factors.

There isn't anything exotic in my Global.asax, as far as I
know. The only thing is in the Session_Start event
handler, which loads a simple Hashtable into a session
variable, that's it, that's all!

Now my control event handlers aren't getting fired, it's
acting really strange!

-v
>-----Original Message-----
>Hi,
>
>Are you using an master page type architecture? The kind

where you have 1
>..aspx page that holds the layout and common features and

then a bunch of
>..ascx pages that are loaded into a place holder for

content? If so you
>might have some code in your Globabl.asax file that is

causing this to
>happen. Just a wild guess, but when I was using that

architecture on a
>project I had that happen. Good luck! Ken.
>
>--
>Ken Dopierala Jr.
>For great ASP.Net web hosting try:
>http://www.webhost4life.com/default.asp?refid=Spinlight
>If you sign up under me and need help, email me.
>
>"V. Jenks" <an*******@discussions.microsoft.com> wrote in

message
>news:13****************************@phx.gbl...
>> It's definitely not, this is inside of a web user control, >> sorry I should have mentioned that.
>>
>> I know the Page_Load event handler from the master page is >> loading but that's not what I'm seeing. The Page_Load in
>> the user control that I'm stepping through fires twice. It >> is not defined twice as I'm stepping through it in the
>> debugger and I'm watching it do it twice.
>>
>> Also, the control that this is happening in is being loaded >> by a Page.LoadControl (asp:placeholder) in the master page. >>
>> Still, this shouldn't happen.
>>
>>
>> >-----Original Message-----
>> >I'm a little rusty having not touched .NET for 6 months and >> >I can't remember why Page_Load is happening twice in this >> code:
>> >
>> > private void Page_Load(object sender, System.EventArgs e) >> > {
>> > //existing session?
>> > if (Session["NewOrder"] == null)
>> > {
>> > //save local empty order object
>> > this._newOrder = Orders.Initialize();
>> >
>> > //create new in facade
>> > Session["NewOrder"] = this._newOrder;
>> > }
>> >
>> > if (!Page.IsPostBack) //bind order items if not posted
>> > this.BindOrderItems();
>> > }
>> >
>> > private void BindOrderItems()
>> > {
>> > //if session is active, bind order items to datagrid
>> > if (this.NewOrder != null && this.NewOrder.OrderItems != >> >null)
>> > {
>> > OrderItemsGrid.DataSource = this.NewOrder.OrderItems;
>> > OrderItemsGrid.DataBind();
>> > }
>> > }
>> >
>> >I know there's a good reason for it but I'm not sure how to >> >prevent/work around it.
>> >
>> >But, anyhow, while stepping through this code, after the
>> >DataGrid is bound (BindOrderItems function) Page_Load
>> >starts over again.
>> >
>> >Any ideas?
>> >
>> >Thanks!
>> >.
>> >
>
>
>.
>

.

Nov 19 '05 #14

P: n/a
Nope, that wasn't it, I'm an idiot apparently.

In my PageBase class, in the Page_Load event I was doing a
redirect on a certain condition.

Well, when the page first loads that condition is always
true and forces the redirect, right back to the originating
page...causing the Page_Load in the PageBase class to fire
a second time.

It was recursive and I didn't even realize it so it was
happening right under my nose.

Thanks for all the help and time guys!

-v

-----Original Message-----
At
http://www.mcse.ms/archive109-2003-12-207567.html

Colin reports that removing this line :

this.Load += new System.EventHandler(this.PageLoadEvent);
fixed the same problem you're having.

Rick Strahl [MVP] turned him on to this reasoning :

---000---
Check the setting of AutoEventHookup on the page. If you're
using CodeBehind pages you generally don't want this as the
CodeBehind page automatically generates the OnLoad() event hookup.
Also if your form is inherited and your event hookups in the
base class (in InitializeComponent) you will end up hooking
the eventhandler multiple times and so it fires more than once.
The solution there is to remove the OnLoad code
manually in the implementation level of the form.
---000---

Let us know if this works.

Good luck!

Juan T. Llibre
===========
"V. Jenks" <an*******@discussions.microsoft.com> wrote in messagenews:30****************************@phx.gbl...
Actually, I forgot to mention one important detail. Each
of my "master" pages inherits from a custom class I wrote,
which itself derives from System.Web.UI.Page.

So, for example, here's my custom PageBase class:

//CODE

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace Scientifik.Fusion
{
/// <summary>
/// Base page class for all main application aspx pages.
/// </summary>
public class PageBase : System.Web.UI.Page
{

public PageBase()
{
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, System.EventArgs e)
{
//I would load the placeholder control here
}
}
}

//END CODE

And here would be the code-behind for a "master page":

//CODE

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace Scientifik.Fusion
{
/// <summary>
/// </summary>
public class pos : PageBase
{
public pos()
{
//default constructor would pass string values to base
class (PageBase)
//which tell the page-loader what to load
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web
Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}

//END CODE

Lo and behold, when stepping through the code, it's
PageBase that's doing Page_Load twice, not the control, it
completely slipped my mind!

Any ideas?

-v
-----Original Message-----
Hi,

A lot of times those systems use the

Application_BeginRequest() subroutine
in the Global.asax to do a Context.RewritePath(). Also

you might want to
make sure that your section master pages aren't named the

same. For example
they might all be named Default.aspx but in different

folders. Other than
that all I can recommend is to watch the tracing of your

app as it runs. I
mean if your page_load runs and then ends and then runs

again something in
between is happening because the page_load isn't calling

itself. The trace
information should at least tell you where your app is

going before it comes
back. Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

<an*******@discussions.microsoft.com> wrote in message
news:14****************************@phx.gbl.. .
Yes, each "section" of my application consists of a master
page with a bunch of dynamically loaded ascx controls based on user-interaction and other factors.

There isn't anything exotic in my Global.asax, as far as I
know. The only thing is in the Session_Start event
handler, which loads a simple Hashtable into a session
variable, that's it, that's all!

Now my control event handlers aren't getting fired, it's
acting really strange!

-v

>-----Original Message-----
>Hi,
>
>Are you using an master page type architecture? The kind
where you have 1
>..aspx page that holds the layout and common features and
then a bunch of
>..ascx pages that are loaded into a place holder for
content? If so you
>might have some code in your Globabl.asax file that is
causing this to
>happen. Just a wild guess, but when I was using that
architecture on a
>project I had that happen. Good luck! Ken.
>
>--
>Ken Dopierala Jr.
>For great ASP.Net web hosting try:
>http://www.webhost4life.com/default.asp?refid=Spinlight
>If you sign up under me and need help, email me.
>
>"V. Jenks" <an*******@discussions.microsoft.com> wrote in
message
>news:13****************************@phx.gbl...
>> It's definitely not, this is inside of a web user

control,
>> sorry I should have mentioned that.
>>
>> I know the Page_Load event handler from the master

page is
>> loading but that's not what I'm seeing. The Page_Load in >> the user control that I'm stepping through fires

twice. It
>> is not defined twice as I'm stepping through it in the
>> debugger and I'm watching it do it twice.
>>
>> Also, the control that this is happening in is being

loaded
>> by a Page.LoadControl (asp:placeholder) in the master

page.
>>
>> Still, this shouldn't happen.
>>
>>
>> >-----Original Message-----
>> >I'm a little rusty having not touched .NET for 6

months and
>> >I can't remember why Page_Load is happening twice in

this
>> code:
>> >
>> > private void Page_Load(object sender,

System.EventArgs e)
>> > {
>> > //existing session?
>> > if (Session["NewOrder"] == null)
>> > {
>> > //save local empty order object
>> > this._newOrder = Orders.Initialize();
>> >
>> > //create new in facade
>> > Session["NewOrder"] = this._newOrder;
>> > }
>> >
>> > if (!Page.IsPostBack) //bind order items if not posted >> > this.BindOrderItems();
>> > }
>> >
>> > private void BindOrderItems()
>> > {
>> > //if session is active, bind order items to datagrid
>> > if (this.NewOrder != null &&

this.NewOrder.OrderItems !=
>> >null)
>> > {
>> > OrderItemsGrid.DataSource = this.NewOrder.OrderItems;
>> > OrderItemsGrid.DataBind();
>> > }
>> > }
>> >
>> >I know there's a good reason for it but I'm not sure

how to
>> >prevent/work around it.
>> >
>> >But, anyhow, while stepping through this code, after the >> >DataGrid is bound (BindOrderItems function) Page_Load
>> >starts over again.
>> >
>> >Any ideas?
>> >
>> >Thanks!
>> >.
>> >
>
>
>.
>
.

.

Nov 19 '05 #15

This discussion thread is closed

Replies have been disabled for this discussion.