Solved

RadioButton event does not fire.

Posted on 2012-03-25
5
815 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now