?
Solved

RadioButton event does not fire.

Posted on 2012-03-25
5
Medium Priority
?
826 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

741 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