Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > RadioButton (or Checkbox) event firing if selected (not changed)

Reply
Thread Tools

RadioButton (or Checkbox) event firing if selected (not changed)

 
 
tshad
Guest
Posts: n/a
 
      03-14-2005
Is there a way to allow a user to press a radio button if it is already
selected?

There is an onCheckedChanged event that fires when the person presses the
button and it is isn't selected already. If it is selected, it doesn't
fire. This isn't the case with a checkbox. The event fires whether the
control is already checked or not.

Thanks,

Tom.


 
Reply With Quote
 
 
 
 
Ken Dopierala Jr.
Guest
Posts: n/a
 
      03-14-2005
Hi Tom,

The reason the checkbox event fires is because it changed. When you click a
radio button that is already set it doesn't change so the onCheckedChanged
even will never fire. You'll need to rethink your design. When a user
clicks a radio button do what you need to do. If you have a radio button
checked as default, then when you dish out the page you will need to setup
your code so that everything you would do when that radio button is selected
is already done. Or, just push out the radio buttons with none of them
selected. Having a user click a radio button to select it, when it is
already selected, to perform some action is not very intuitive and probably
would just confuse the user. 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.

"tshad" <> wrote in message
news:%...
> Is there a way to allow a user to press a radio button if it is already
> selected?
>
> There is an onCheckedChanged event that fires when the person presses the
> button and it is isn't selected already. If it is selected, it doesn't
> fire. This isn't the case with a checkbox. The event fires whether the
> control is already checked or not.
>
> Thanks,
>
> Tom.
>
>



 
Reply With Quote
 
 
 
 
Joaquin Corchero
Guest
Posts: n/a
 
      03-14-2005
What you could do is create the event in JavaScript, with the control being
in the server side. You could do that by closing the object in a span an
firing a function in the onclick of the span or the object that you have
your checkbox in.

Good Luck


"tshad" <> wrote in message
news:%...
> Is there a way to allow a user to press a radio button if it is already
> selected?
>
> There is an onCheckedChanged event that fires when the person presses the
> button and it is isn't selected already. If it is selected, it doesn't
> fire. This isn't the case with a checkbox. The event fires whether the
> control is already checked or not.
>
> Thanks,
>
> Tom.
>
>



 
Reply With Quote
 
tshad
Guest
Posts: n/a
 
      03-14-2005
"Ken Dopierala Jr." <> wrote in message
news:%...
> Hi Tom,
>
> The reason the checkbox event fires is because it changed. When you click
> a
> radio button that is already set it doesn't change so the onCheckedChanged
> even will never fire. You'll need to rethink your design. When a user
> clicks a radio button do what you need to do. If you have a radio button
> checked as default, then when you dish out the page you will need to setup
> your code so that everything you would do when that radio button is
> selected
> is already done. Or, just push out the radio buttons with none of them
> selected. Having a user click a radio button to select it, when it is
> already selected, to perform some action is not very intuitive and
> probably
> would just confuse the user. Good luck! Ken.


I agree.

I was trying to build a setup where the user indicates which row to move but
selecting a radio button. I was also using the button to deselect the row
(which you can't do if it is already selected - as you know). I went to the
checkbox, because it does allow you to select/deselect it. But then you get
the same problem - that it is counter-intuitive to the user who is used to
selecting multiple checkboxes (which would not be the case here).

What I will probably do is go back to the radio button, with a like that
says "deselect"?

Thanks,

Tom
>
> --
> 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.
>
> "tshad" <> wrote in message
> news:%...
>> Is there a way to allow a user to press a radio button if it is already
>> selected?
>>
>> There is an onCheckedChanged event that fires when the person presses the
>> button and it is isn't selected already. If it is selected, it doesn't
>> fire. This isn't the case with a checkbox. The event fires whether the
>> control is already checked or not.
>>
>> Thanks,
>>
>> Tom.
>>
>>

>
>



 
Reply With Quote
 
tshad
Guest
Posts: n/a
 
      03-14-2005
"Joaquin Corchero" <> wrote in message
news:...
> What you could do is create the event in JavaScript, with the control
> being in the server side. You could do that by closing the object in a
> span an firing a function in the onclick of the span or the object that
> you have your checkbox in.


Not really quite sure how to do that.

My problem would be how to get the javascript to access the objects in the
row.

When I selected a button it changes the color of the row as well as some of
the labels to indicate the row has been selected. When I select it the
second time, it puts it all back to it's original state.

Not quite sure how I could easily do this from Javascript.

Thanks,

Tom
>
> Good Luck
>
>
> "tshad" <> wrote in message
> news:%...
>> Is there a way to allow a user to press a radio button if it is already
>> selected?
>>
>> There is an onCheckedChanged event that fires when the person presses the
>> button and it is isn't selected already. If it is selected, it doesn't
>> fire. This isn't the case with a checkbox. The event fires whether the
>> control is already checked or not.
>>
>> Thanks,
>>
>> Tom.
>>
>>

>
>



 
Reply With Quote
 
Joaquin Corchero
Guest
Posts: n/a
 
      03-15-2005
Hi,

Can you tell me if when you look at the code generated in the client browser
you have an ID for each object?

<td id="td1"???



"tshad" <> wrote in message
news:%...
> "Joaquin Corchero" <> wrote in message
> news:...
>> What you could do is create the event in JavaScript, with the control
>> being in the server side. You could do that by closing the object in a
>> span an firing a function in the onclick of the span or the object that
>> you have your checkbox in.

>
> Not really quite sure how to do that.
>
> My problem would be how to get the javascript to access the objects in the
> row.
>
> When I selected a button it changes the color of the row as well as some
> of the labels to indicate the row has been selected. When I select it the
> second time, it puts it all back to it's original state.
>
> Not quite sure how I could easily do this from Javascript.
>
> Thanks,
>
> Tom
>>
>> Good Luck
>>
>>
>> "tshad" <> wrote in message
>> news:%...
>>> Is there a way to allow a user to press a radio button if it is already
>>> selected?
>>>
>>> There is an onCheckedChanged event that fires when the person presses
>>> the
>>> button and it is isn't selected already. If it is selected, it doesn't
>>> fire. This isn't the case with a checkbox. The event fires whether the
>>> control is already checked or not.
>>>
>>> Thanks,
>>>
>>> Tom.
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RadioButton CheckChanged event not firing on first selection Emma Middlebrook ASP .Net 0 04-23-2008 02:05 PM
event fired on allready selected radiobutton =?Utf-8?B?16nXntei15XXnyDXpC4=?= ASP .Net 5 07-13-2005 03:39 PM
Validation: Making sure a RadioButton is selected Nathan Sokalski ASP .Net 1 06-16-2005 11:08 PM
Selected Index event not firing moondaddy ASP .Net 12 05-12-2004 03:42 AM
onclick firing twice for CheckBox and RadioButton... alien2_51 ASP .Net 2 11-13-2003 08:03 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57