Solved

RadioButton event does not fire.

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 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

13 Experts available now in Live!

Get 1:1 Help Now