473,385 Members | 1,782 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,385 software developers and data experts.

Checkbox.CheckedChanged has a mind of its own

I've got a very simple ASCX page, where once someone finishes a section and
clicks the "Next >" button, the section they just finished is disabled, and
the next section appears below it, and so on. One of the controls is a
checkbox, which, when clicked, displays a hidden panel containing controls
whose input are used for filtering query results.

If someone checks the checkbox in the first section and clicks the first
"Next >" button, the checkbox stays checked, all is well. Problem is, on
the next postback, CheckedChanged is being called again on the first
checkbox, which has definitely not been changed by the user (remember, it's
disabled)!

Viewstate is not disabled in the ASCX control or the parent ASPX page,
though I'm sure it has something to do with a hole in my page lifecycle
knowledge... any suggestions?

--
Greg Hurlman
ghurlman*AT*squaretwo*DOT*net
http://www.squaretwo.net

Nov 18 '05 #1
5 3101
I did a simple test and you are correct. When viewstate is disabled the
checkbox will keep firing.

The reason is the checkbox has no idea what its previous state is because
viewstate is disabled. So when the user postback data is processed for the
checkbox, the checkbox doesn't know what the previous state is, but it does
detect data coming in from the form, so it assumes an event must be fired. I
tried textbox and the same happens there.

- J

"Greg Hurlman" <ghurlman*AT*squaretwo*DOT*net> wrote in message
news:#A**************@TK2MSFTNGP10.phx.gbl...
I've got a very simple ASCX page, where once someone finishes a section and clicks the "Next >" button, the section they just finished is disabled, and the next section appears below it, and so on. One of the controls is a
checkbox, which, when clicked, displays a hidden panel containing controls
whose input are used for filtering query results.

If someone checks the checkbox in the first section and clicks the first
"Next >" button, the checkbox stays checked, all is well. Problem is, on
the next postback, CheckedChanged is being called again on the first
checkbox, which has definitely not been changed by the user (remember, it's disabled)!

Viewstate is not disabled in the ASCX control or the parent ASPX page,
though I'm sure it has something to do with a hole in my page lifecycle
knowledge... any suggestions?

--
Greg Hurlman
ghurlman*AT*squaretwo*DOT*net
http://www.squaretwo.net

Nov 18 '05 #2
You misread... ViewState is *not* disabled... if it were, I would've moved
on by now. :)

--
Greg Hurlman
ghurlman*AT*squaretwo*DOT*net
http://www.squaretwo.net
"NoOne" <No@Where.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I did a simple test and you are correct. When viewstate is disabled the
checkbox will keep firing.

The reason is the checkbox has no idea what its previous state is because
viewstate is disabled. So when the user postback data is processed for the
checkbox, the checkbox doesn't know what the previous state is, but it does detect data coming in from the form, so it assumes an event must be fired. I tried textbox and the same happens there.

- J

"Greg Hurlman" <ghurlman*AT*squaretwo*DOT*net> wrote in message
news:#A**************@TK2MSFTNGP10.phx.gbl...
I've got a very simple ASCX page, where once someone finishes a section

and
clicks the "Next >" button, the section they just finished is disabled,

and
the next section appears below it, and so on. One of the controls is a
checkbox, which, when clicked, displays a hidden panel containing controls whose input are used for filtering query results.

If someone checks the checkbox in the first section and clicks the first
"Next >" button, the checkbox stays checked, all is well. Problem is, on the next postback, CheckedChanged is being called again on the first
checkbox, which has definitely not been changed by the user (remember,

it's
disabled)!

Viewstate is not disabled in the ASCX control or the parent ASPX page,
though I'm sure it has something to do with a hole in my page lifecycle
knowledge... any suggestions?

--
Greg Hurlman
ghurlman*AT*squaretwo*DOT*net
http://www.squaretwo.net


Nov 18 '05 #3
Oops sorry about that.

Well then I modified my simple example to use viewstate, I disabled the
checkbox after its clicked, and I no longer get the event. So it may be
something you are doing in code.

- J
"Greg Hurlman" <ghurlman*AT*squaretwo*DOT*net> wrote in message
news:u8**************@TK2MSFTNGP12.phx.gbl...
You misread... ViewState is *not* disabled... if it were, I would've moved
on by now. :)

--
Greg Hurlman
ghurlman*AT*squaretwo*DOT*net
http://www.squaretwo.net
"NoOne" <No@Where.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I did a simple test and you are correct. When viewstate is disabled the
checkbox will keep firing.

The reason is the checkbox has no idea what its previous state is because
viewstate is disabled. So when the user postback data is processed for the checkbox, the checkbox doesn't know what the previous state is, but it does
detect data coming in from the form, so it assumes an event must be fired. I
tried textbox and the same happens there.

- J

"Greg Hurlman" <ghurlman*AT*squaretwo*DOT*net> wrote in message
news:#A**************@TK2MSFTNGP10.phx.gbl...
I've got a very simple ASCX page, where once someone finishes a section and
clicks the "Next >" button, the section they just finished is
disabled, and
the next section appears below it, and so on. One of the controls is

a checkbox, which, when clicked, displays a hidden panel containing

controls whose input are used for filtering query results.

If someone checks the checkbox in the first section and clicks the first "Next >" button, the checkbox stays checked, all is well. Problem is, on the next postback, CheckedChanged is being called again on the first
checkbox, which has definitely not been changed by the user (remember,

it's
disabled)!

Viewstate is not disabled in the ASCX control or the parent ASPX page,
though I'm sure it has something to do with a hole in my page lifecycle knowledge... any suggestions?

--
Greg Hurlman
ghurlman*AT*squaretwo*DOT*net
http://www.squaretwo.net



Nov 18 '05 #4
Care to eloborate or show some code on what you are doing exactly?
"NoOne" <No@Where.com> wrote in message
news:ui**************@tk2msftngp13.phx.gbl...
Oops sorry about that.

Well then I modified my simple example to use viewstate, I disabled the
checkbox after its clicked, and I no longer get the event. So it may be
something you are doing in code.

- J
"Greg Hurlman" <ghurlman*AT*squaretwo*DOT*net> wrote in message
news:u8**************@TK2MSFTNGP12.phx.gbl...
You misread... ViewState is *not* disabled... if it were, I would've moved
on by now. :)

--
Greg Hurlman
ghurlman*AT*squaretwo*DOT*net
http://www.squaretwo.net
"NoOne" <No@Where.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I did a simple test and you are correct. When viewstate is disabled the checkbox will keep firing.

The reason is the checkbox has no idea what its previous state is because viewstate is disabled. So when the user postback data is processed for the checkbox, the checkbox doesn't know what the previous state is, but it does
detect data coming in from the form, so it assumes an event must be fired.
I
tried textbox and the same happens there.

- J

"Greg Hurlman" <ghurlman*AT*squaretwo*DOT*net> wrote in message
news:#A**************@TK2MSFTNGP10.phx.gbl...
> I've got a very simple ASCX page, where once someone finishes a

section and
> clicks the "Next >" button, the section they just finished is disabled, and
> the next section appears below it, and so on. One of the controls is a
> checkbox, which, when clicked, displays a hidden panel containing

controls
> whose input are used for filtering query results.
>
> If someone checks the checkbox in the first section and clicks the first > "Next >" button, the checkbox stays checked, all is well. Problem
is, on
> the next postback, CheckedChanged is being called again on the first
> checkbox, which has definitely not been changed by the user

(remember, it's
> disabled)!
>
> Viewstate is not disabled in the ASCX control or the parent ASPX page, > though I'm sure it has something to do with a hole in my page

lifecycle > knowledge... any suggestions?
>
> --
> Greg Hurlman
> ghurlman*AT*squaretwo*DOT*net
> http://www.squaretwo.net
>
>
>



Nov 18 '05 #5
Sure... I've zipped & attached the host ASPX page, ASCX file, and their
code-behind files. In addition, I failed to mention earlier that the
control is being dynamically loaded in the host page, but I have tested it
being explicitly declared, and I get the same results.

Thanks for your help!

--
Greg Hurlman
ghurlman*AT*squaretwo*DOT*net
http://www.squaretwo.net
"NoOne" <No@Where.com> wrote in message
news:e2**************@tk2msftngp13.phx.gbl...
Care to eloborate or show some code on what you are doing exactly?
"NoOne" <No@Where.com> wrote in message
news:ui**************@tk2msftngp13.phx.gbl...
Oops sorry about that.

Well then I modified my simple example to use viewstate, I disabled the
checkbox after its clicked, and I no longer get the event. So it may be
something you are doing in code.

- J
"Greg Hurlman" <ghurlman*AT*squaretwo*DOT*net> wrote in message
news:u8**************@TK2MSFTNGP12.phx.gbl...
You misread... ViewState is *not* disabled... if it were, I would've moved on by now. :)

--
Greg Hurlman
ghurlman*AT*squaretwo*DOT*net
http://www.squaretwo.net
"NoOne" <No@Where.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
> I did a simple test and you are correct. When viewstate is disabled the > checkbox will keep firing.
>
> The reason is the checkbox has no idea what its previous state is

because
> viewstate is disabled. So when the user postback data is processed for
the
> checkbox, the checkbox doesn't know what the previous state is, but
it does
> detect data coming in from the form, so it assumes an event must be

fired.
I
> tried textbox and the same happens there.
>
> - J
>
> "Greg Hurlman" <ghurlman*AT*squaretwo*DOT*net> wrote in message
> news:#A**************@TK2MSFTNGP10.phx.gbl...
> > I've got a very simple ASCX page, where once someone finishes a

section
> and
> > clicks the "Next >" button, the section they just finished is

disabled,
> and
> > the next section appears below it, and so on. One of the controls

is
a
> > checkbox, which, when clicked, displays a hidden panel containing
controls
> > whose input are used for filtering query results.
> >
> > If someone checks the checkbox in the first section and clicks the

first
> > "Next >" button, the checkbox stays checked, all is well. Problem

is, on
> > the next postback, CheckedChanged is being called again on the first > > checkbox, which has definitely not been changed by the user (remember, > it's
> > disabled)!
> >
> > Viewstate is not disabled in the ASCX control or the parent ASPX page, > > though I'm sure it has something to do with a hole in my page

lifecycle
> > knowledge... any suggestions?
> >
> > --
> > Greg Hurlman
> > ghurlman*AT*squaretwo*DOT*net
> > http://www.squaretwo.net
> >
> >
> >
>
>





Nov 18 '05 #6

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

Similar topics

2
by: Tomas Vera | last post by:
Hello All, I'm having problems creating a page with dynamic checkboxes in a WebApp. In my app, I need to query a database, then (based on results) add checkboxes to my form and set their...
4
by: mahsa | last post by:
my problem dosent solve yet I want to have claa void in onclick of my check bov if I us function setProps ( ) msg.innerText = "llll"; in <datalist> <ItemTemplate><input type="checkbox"...
3
by: DotNetJunkies User | last post by:
Hi, I have a checkbox control programmatically created for each row in the datagrid but CheckedChanged event not firing when state of the checkbox changes. I use the following code to...
1
by: dx | last post by:
I'm extremely frustrated with ASP.NET...again! To me this should be as simple as setting oCheckBox.Checked = True.. yet for some reason it isn't. I have a user control (ascx) that that has a...
3
by: Woo Mun Foong | last post by:
I have a checkbox, when enable, allows me to proceed with what I like to do. However, I need to check a certain conditions before I allow the checked box to be checked, if condition is not fullfill...
5
by: c_shah | last post by:
using VB.net (2005) ASP.net 2.0 I have a repeater control with the item template, in the item template I have two checkboxes How to capture event When user checks the checkboxes? What event...
2
by: =?Utf-8?B?UmljaA==?= | last post by:
Is there a cancel argument for cancelling if you want to check or uncheck a checkbox? In the checkChanged event of a checkbox I ask the user if they are sure they want to check/uncheck...
3
by: Ryanfromscotland | last post by:
Hey there everyone, this is my first post so be nice :-) I have wrote quite a bit so the actual question is written out at the end if you want to skip on and see if you can answer it without the rest...
1
by: iderocks | last post by:
Hi All, I created a dynamic checkbox in ASP .Net inside a Button1_Click event method (outside the page_load event) and performed the event handling method for the CheckedChanged event and when I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.