Solved

RadioButton event does not fire.

Posted on 2012-03-25
5
820 Views
Last Modified: 2012-03-30
I have 2 radio buttons that are members of a group.

The CheckedChanged event does not fire.


This is what I have:

Arrange Board:    
    <asp:RadioButton ID="optByRank" runat="server" Text="By Rank"
        TextAlign="Left" Checked="True"
        oncheckedchanged="optByRank_CheckedChanged" GroupName="ArrangeBoard" />
    &nbsp;
    <asp:RadioButton ID="optBySuit" runat="server"  Text="By Suit"
    TextAlign="Left"   Checked="False"
        oncheckedchanged="optBySuit_CheckedChanged" GroupName="ArrangeBoard" />
   
    <br/>

Code File:

 protected void optByRank_CheckedChanged(object sender, EventArgs e)
    {
        int intTest = 1;  // Line marked fro debug mode.  Code does not break.
    }

    protected void optBySuit_CheckedChanged(object sender, EventArgs e)
    {
        int intTest = 2;   // Line marked fro debug mode.  Code does not break.
    }

What do I need to change?

Thanks,
0
Comment
Question by:Dovberman
  • 3
5 Comments
 
LVL 14

Expert Comment

by:nishant joshi
ID: 37763073
on check changes you have to add same event because radio buttons are in same group.
so with 2 radio button.if you click on other then both value changes so both event fired might with not desirable so just use method. for a group.

Regards,
nishant
0
 

Accepted Solution

by:
Dovberman earned 0 total points
ID: 37763125
I set AutoPostBack="True" for both radio buttons. This worked.

Ref; Visual Studio Help. RadioButton Event

Occurs when the selection from the list control changes between posts to the server. (Inherited from ListControl.)
0
 
LVL 7

Expert Comment

by:Lalit Chandra
ID: 37763129
Why don't you use javascript/Jquery for this to do action on the client side itself. In your case
(AutoPostBack = true), the whole page get posted to server to do only little things.So,Is it worth to do a Round-Trip to server only because you want to init some variables.
0
 

Author Comment

by:Dovberman
ID: 37763588
Yes, Javascript would be usesul in a high traffic situation. I may consider it later.
0
 

Author Closing Comment

by:Dovberman
ID: 37786122
Found the solution based on the Help section.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question