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

Discussion in 'ASP .Net' started by tshad, Mar 14, 2005.

  1. tshad

    tshad Guest

    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.
     
    tshad, Mar 14, 2005
    #1
    1. Advertising

  2. 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.
    >
    >
     
    Ken Dopierala Jr., Mar 14, 2005
    #2
    1. Advertising

  3. 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.
    >
    >
     
    Joaquin Corchero, Mar 14, 2005
    #3
  4. tshad

    tshad Guest

    "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.
    >>
    >>

    >
    >
     
    tshad, Mar 14, 2005
    #4
  5. tshad

    tshad Guest

    "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.
    >>
    >>

    >
    >
     
    tshad, Mar 14, 2005
    #5
  6. 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.
    >>>
    >>>

    >>
    >>

    >
    >
     
    Joaquin Corchero, Mar 15, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. alien2_51
    Replies:
    2
    Views:
    3,966
  2. Emma Middlebrook
    Replies:
    0
    Views:
    577
    Emma Middlebrook
    Apr 23, 2008
  3. mldardy
    Replies:
    0
    Views:
    998
    mldardy
    Sep 28, 2010
  4. shiv

    CheckBox Changed Event Not Firing in DataGrid

    shiv, Jun 18, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    565
  5. Rob
    Replies:
    1
    Views:
    600
    Teemu Keiski
    Aug 1, 2007
Loading...

Share This Page