Solved

RadioButton event does not fire.

Posted on 2012-03-25
5
824 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

717 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