473,320 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

What happens between events Load and PreRender. ASP.NET bug?

Hi,

First of all sorry for the long post but I believe it is quite an
interesting as well as advanced and complex problem.

I have a problem with the checkbox control I have in my repeater.
I am using a repeater that I bind to some data in the Page_Load method.
That page is heavy and highly dynamic and the viewstate of the repeater and
all the controls existing in that repeater are set to "False" as none of the
information in the repeater needs to be posted back to the server. It is
rather an other control in that page that makes the postback happen and
repopulate the repeater upon those values. Those controls actually filter
date in and out. The repeater can be seen as a read only view of data.

To visualize the problem let have a simplified view of the repeater and for
later purpose, I will also put in brackets the UniqueID of each checkbox
control in my repeater. My repeater got 3 rows, each row got a checkbox.

row number -- checkbox
1 true
(Repeater:_ctl1:CheckBoxSuspended)
2 false
(Repeater:_ctl2:CheckBoxSuspended)
3 false
(Repeater:_ctl3:CheckBoxSuspended)

When i select some options in my page that makes the page postback, the
Page_Load run, and due to the option i chose, only the row number 3 will be
selected from my dataset and then only that row will be binded to my
repeater.
In the Repeater_ItemDataBound event handler, I read the checkbox value from
the database (which is false) and assign in to the checkbox. So far, so
good. But the HTML rendered displays the checkbox being true.

To visualize the problem, My repeater displays:

rowNumber -- checkbox
3 true
(Repeater:_ctl1:CheckBoxSuspended)

instead of:

rowNumber -- checkbox
3 false
(Repeater:_ctl1:CheckBoxSuspended)

Wondering why, I overloaded a few event handlers in my page and I see that
AFTER Page.OnLoad() method is called and BEFORE Page.OnPreRender() is
called, the checkbox value is changed from false (the value i manually set
when i databind the repeater) to true, thus making the CheckedChanged event
to fire.
My only clue is that in between Page.OnLoad() and Page.OnPreRender() , the
ASP.NET runtime retrieves what ASP.NET think is the past value of the
checkbox (as it takes the old value of the control with the uniqueID
Repeater:_ctl1:CheckBoxSuspended and put it in the new control with that
same UniqueID). The problem is that even those controls have the same
UniqueID, they correspond to different data in the DB and then, must keep
their value I set at databinding time.
Then I wonder if there is a bug in the ASP.NET lifecyle or if it is me who
is not aware of some features. But i think it is very strange that ASP.NET
decide by "itself" to set the value of my checkbox control AFTER I set it by
myself in the binding of my repeater. This is in my opinion something that
should never happen.
Also where does ASP.NET can possibly know what was the previous value of
Repeater:_ctl1:CheckBoxSuspended as i set EnableViewState="False" in the
aspx code? Is it from some cache? or is the viewstate saved anyway?

Any guru in here who can give me an help and explain me how to solve this?
If needed i could send over all my source code but as it is part of an
application that would mean a lot of code!

Best regards and thanks to have read this until the end !

Francois
Nov 18 '05 #1
3 2593
Just post the code where the checked state of the checkbox is set
(databinding?)
(probably in page load)

cheers,
mortb
"Francois" <fr******@bettinghouses.com_NOSPAM> wrote in message
news:Oh**************@TK2MSFTNGP15.phx.gbl...
Hi,

First of all sorry for the long post but I believe it is quite an
interesting as well as advanced and complex problem.

I have a problem with the checkbox control I have in my repeater.
I am using a repeater that I bind to some data in the Page_Load method.
That page is heavy and highly dynamic and the viewstate of the repeater
and
all the controls existing in that repeater are set to "False" as none of
the
information in the repeater needs to be posted back to the server. It is
rather an other control in that page that makes the postback happen and
repopulate the repeater upon those values. Those controls actually filter
date in and out. The repeater can be seen as a read only view of data.

To visualize the problem let have a simplified view of the repeater and
for
later purpose, I will also put in brackets the UniqueID of each checkbox
control in my repeater. My repeater got 3 rows, each row got a checkbox.

row number -- checkbox
1 true
(Repeater:_ctl1:CheckBoxSuspended)
2 false
(Repeater:_ctl2:CheckBoxSuspended)
3 false
(Repeater:_ctl3:CheckBoxSuspended)

When i select some options in my page that makes the page postback, the
Page_Load run, and due to the option i chose, only the row number 3 will
be
selected from my dataset and then only that row will be binded to my
repeater.
In the Repeater_ItemDataBound event handler, I read the checkbox value
from
the database (which is false) and assign in to the checkbox. So far, so
good. But the HTML rendered displays the checkbox being true.

To visualize the problem, My repeater displays:

rowNumber -- checkbox
3 true
(Repeater:_ctl1:CheckBoxSuspended)

instead of:

rowNumber -- checkbox
3 false
(Repeater:_ctl1:CheckBoxSuspended)

Wondering why, I overloaded a few event handlers in my page and I see that
AFTER Page.OnLoad() method is called and BEFORE Page.OnPreRender() is
called, the checkbox value is changed from false (the value i manually set
when i databind the repeater) to true, thus making the CheckedChanged
event
to fire.
My only clue is that in between Page.OnLoad() and Page.OnPreRender() , the
ASP.NET runtime retrieves what ASP.NET think is the past value of the
checkbox (as it takes the old value of the control with the uniqueID
Repeater:_ctl1:CheckBoxSuspended and put it in the new control with that
same UniqueID). The problem is that even those controls have the same
UniqueID, they correspond to different data in the DB and then, must keep
their value I set at databinding time.
Then I wonder if there is a bug in the ASP.NET lifecyle or if it is me who
is not aware of some features. But i think it is very strange that ASP.NET
decide by "itself" to set the value of my checkbox control AFTER I set it
by
myself in the binding of my repeater. This is in my opinion something that
should never happen.
Also where does ASP.NET can possibly know what was the previous value of
Repeater:_ctl1:CheckBoxSuspended as i set EnableViewState="False" in the
aspx code? Is it from some cache? or is the viewstate saved anyway?

Any guru in here who can give me an help and explain me how to solve this?
If needed i could send over all my source code but as it is part of an
application that would mean a lot of code!

Best regards and thanks to have read this until the end !

Francois

Nov 18 '05 #2
in the databinding, the binding code is:

CheckBoxValue checkBoxSuspended = (CheckBoxValue)
repeaterItem.FindControl("CheckBoxSuspended");
checkBoxSuspended.Checked = (bool) record["isSuspended"];
checkBoxSuspended.Attributes.Add("onclick", "changeSuspendGame(" +
checkBoxSuspended.ClientID + ", " + gameId + ")");

But this code works well as when i run it in debug mode everything is fine,
as i said in the original post it is later that some internal code of the
asp.net runtime changes the values by itself.

Francois
"mortb" <mortb1<noospam<@hotmail.com> wrote in message
news:ew**************@TK2MSFTNGP10.phx.gbl...
Just post the code where the checked state of the checkbox is set
(databinding?)
(probably in page load)

cheers,
mortb
"Francois" <fr******@bettinghouses.com_NOSPAM> wrote in message
news:Oh**************@TK2MSFTNGP15.phx.gbl...
Hi,

First of all sorry for the long post but I believe it is quite an
interesting as well as advanced and complex problem.

I have a problem with the checkbox control I have in my repeater.
I am using a repeater that I bind to some data in the Page_Load method.
That page is heavy and highly dynamic and the viewstate of the repeater
and
all the controls existing in that repeater are set to "False" as none of
the
information in the repeater needs to be posted back to the server. It is
rather an other control in that page that makes the postback happen and
repopulate the repeater upon those values. Those controls actually filter date in and out. The repeater can be seen as a read only view of data.

To visualize the problem let have a simplified view of the repeater and
for
later purpose, I will also put in brackets the UniqueID of each checkbox
control in my repeater. My repeater got 3 rows, each row got a checkbox.

row number -- checkbox
1 true
(Repeater:_ctl1:CheckBoxSuspended)
2 false
(Repeater:_ctl2:CheckBoxSuspended)
3 false
(Repeater:_ctl3:CheckBoxSuspended)

When i select some options in my page that makes the page postback, the
Page_Load run, and due to the option i chose, only the row number 3 will
be
selected from my dataset and then only that row will be binded to my
repeater.
In the Repeater_ItemDataBound event handler, I read the checkbox value
from
the database (which is false) and assign in to the checkbox. So far, so
good. But the HTML rendered displays the checkbox being true.

To visualize the problem, My repeater displays:

rowNumber -- checkbox
3 true
(Repeater:_ctl1:CheckBoxSuspended)

instead of:

rowNumber -- checkbox
3 false
(Repeater:_ctl1:CheckBoxSuspended)

Wondering why, I overloaded a few event handlers in my page and I see that AFTER Page.OnLoad() method is called and BEFORE Page.OnPreRender() is
called, the checkbox value is changed from false (the value i manually set when i databind the repeater) to true, thus making the CheckedChanged
event
to fire.
My only clue is that in between Page.OnLoad() and Page.OnPreRender() , the ASP.NET runtime retrieves what ASP.NET think is the past value of the
checkbox (as it takes the old value of the control with the uniqueID
Repeater:_ctl1:CheckBoxSuspended and put it in the new control with that
same UniqueID). The problem is that even those controls have the same
UniqueID, they correspond to different data in the DB and then, must keep their value I set at databinding time.
Then I wonder if there is a bug in the ASP.NET lifecyle or if it is me who is not aware of some features. But i think it is very strange that ASP.NET decide by "itself" to set the value of my checkbox control AFTER I set it by
myself in the binding of my repeater. This is in my opinion something that should never happen.
Also where does ASP.NET can possibly know what was the previous value of
Repeater:_ctl1:CheckBoxSuspended as i set EnableViewState="False" in the
aspx code? Is it from some cache? or is the viewstate saved anyway?

Any guru in here who can give me an help and explain me how to solve this? If needed i could send over all my source code but as it is part of an
application that would mean a lot of code!

Best regards and thanks to have read this until the end !

Francois


Nov 18 '05 #3
after a control is created, the ipostbackdatahandler is called if any
postback data is found for it. control which will receive postback data
must be created by prerender.

if you data is readonly, rather than use a checkboxs and textboxes, which
have to postback, use images and literals. you could also create a new
checkbox control which ignored the postback data.
-- bruce (sqlwork.com)

"Francois" <fr******@bettinghouses.com_NOSPAM> wrote in message
news:Oh**************@TK2MSFTNGP15.phx.gbl...
| Hi,
|
| First of all sorry for the long post but I believe it is quite an
| interesting as well as advanced and complex problem.
|
| I have a problem with the checkbox control I have in my repeater.
| I am using a repeater that I bind to some data in the Page_Load method.
| That page is heavy and highly dynamic and the viewstate of the repeater
and
| all the controls existing in that repeater are set to "False" as none of
the
| information in the repeater needs to be posted back to the server. It is
| rather an other control in that page that makes the postback happen and
| repopulate the repeater upon those values. Those controls actually filter
| date in and out. The repeater can be seen as a read only view of data.
|
| To visualize the problem let have a simplified view of the repeater and
for
| later purpose, I will also put in brackets the UniqueID of each checkbox
| control in my repeater. My repeater got 3 rows, each row got a checkbox.
|
| row number -- checkbox
| 1 true
| (Repeater:_ctl1:CheckBoxSuspended)
| 2 false
| (Repeater:_ctl2:CheckBoxSuspended)
| 3 false
| (Repeater:_ctl3:CheckBoxSuspended)
|
| When i select some options in my page that makes the page postback, the
| Page_Load run, and due to the option i chose, only the row number 3 will
be
| selected from my dataset and then only that row will be binded to my
| repeater.
| In the Repeater_ItemDataBound event handler, I read the checkbox value
from
| the database (which is false) and assign in to the checkbox. So far, so
| good. But the HTML rendered displays the checkbox being true.
|
| To visualize the problem, My repeater displays:
|
| rowNumber -- checkbox
| 3 true
| (Repeater:_ctl1:CheckBoxSuspended)
|
| instead of:
|
| rowNumber -- checkbox
| 3 false
| (Repeater:_ctl1:CheckBoxSuspended)
|
| Wondering why, I overloaded a few event handlers in my page and I see that
| AFTER Page.OnLoad() method is called and BEFORE Page.OnPreRender() is
| called, the checkbox value is changed from false (the value i manually set
| when i databind the repeater) to true, thus making the CheckedChanged
event
| to fire.
| My only clue is that in between Page.OnLoad() and Page.OnPreRender() , the
| ASP.NET runtime retrieves what ASP.NET think is the past value of the
| checkbox (as it takes the old value of the control with the uniqueID
| Repeater:_ctl1:CheckBoxSuspended and put it in the new control with that
| same UniqueID). The problem is that even those controls have the same
| UniqueID, they correspond to different data in the DB and then, must keep
| their value I set at databinding time.
| Then I wonder if there is a bug in the ASP.NET lifecyle or if it is me who
| is not aware of some features. But i think it is very strange that ASP.NET
| decide by "itself" to set the value of my checkbox control AFTER I set it
by
| myself in the binding of my repeater. This is in my opinion something that
| should never happen.
| Also where does ASP.NET can possibly know what was the previous value of
| Repeater:_ctl1:CheckBoxSuspended as i set EnableViewState="False" in the
| aspx code? Is it from some cache? or is the viewstate saved anyway?
|
| Any guru in here who can give me an help and explain me how to solve this?
| If needed i could send over all my source code but as it is part of an
| application that would mean a lot of code!
|
| Best regards and thanks to have read this until the end !
|
| Francois
|
|
Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Josema | last post by:
Hi, Im reading that this is the Control Execution Lifecycle Initialize, Load View state Process postback data, load, send postback change notifications, handle posrback events, prerender, save...
5
by: Daniel Groh | last post by:
Hi, i'd like to know more abou this event, i tryed to found in MSDN but the explanation is null for me...is there some explanation when and how should i use it ?
2
by: luca | last post by:
I'm trying to build a Server Control, it's a calendar to manage sellers appointments (don't answer me to use and custumize Calendar Control because unluckily it's not possible for this specific...
2
by: RAJ | last post by:
In our multi-tier application, we have several ASP.NET user controls which will update the same data source provided by middle tier logic. In this particular scenario we have one user control...
7
by: Dan Nash | last post by:
Hi guys Ok, i have an aspx with a user control. In the user controls pageload i set a property (mystring = "test";). i then want to access that from the page_load of the aspx thats using the...
1
by: Mariella Bakker | last post by:
Hi All, In an ASP.NET project I am trying to improve performance. As it is now there seems to be a huge bottleneck between the end of the Page.PreRender event and the beginning of the...
0
by: John Smith | last post by:
I still have not gotten this damn thing figured out and I'm asking for help one last time before I give up on it. I have a user control that contains a paged gridview control. The master page...
1
by: mpaine | last post by:
I have read http://msdn2.microsoft.com/en-us/library/ms178472(VS.80).aspx and my interpretation is that custom events should be fired between Page_Load and Page_LoadComplete. When I run the...
0
by: Michal Valent | last post by:
this is ProcessRequestMain from System.Web.UI.Page Assembly: System.Web, Version=2.0.0.0 the question is how can one custom server control make its events fired earlier than Page_Load event ?
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.