radio button

  • Thread starter Thread starter Claudia Fong
  • Start date Start date
C

Claudia Fong

Hi
I have two radio button in my webform. One fo them is selected by
default.
I wrote some simple c# code like this below:

protected void rdoLoad_CheckedChanged(object sender, EventArgs e)
{
if (rdoLoad.Checked == true)
MessageBox.Show("testing OK");

}

But when I was testing, even if I select the other radio button
(rdoLoad), it won't show the message box..

What should I do?

Do I need to write something in my source file of my ASP.NET?

Cheers!

Claudi
 
It's doing exactly what you told it to. You check if it's true, and show the
message. If it's false (when you select the other radio button) it does
nothing.
 
When I say the other radio button I meant the one that I have the code..
Is true and it won't pop up the message box...
I have this 2 radio button define like this

<asp:radiobutton ID="rdoLoad" runat="server" Text="Load"
GroupName="MyGroup" OnCheckedChanged="rdoLoad_CheckedChanged">
</asp:radiobutton>

<asp:radiobutton ID="rdoUnload" runat="server" Text="Unload"
Checked="True" GroupName="MyGroup" OnClick="rdoUnload_Click>
</asp:radiobutton></td>

Cheers!

Claudi
 
Claudia Fong said:
When I say the other radio button I meant the one that I have the code..
Is true and it won't pop up the message box...
I have this 2 radio button define like this

<asp:radiobutton ID="rdoLoad" runat="server" Text="Load"
GroupName="MyGroup" OnCheckedChanged="rdoLoad_CheckedChanged">
</asp:radiobutton>

<asp:radiobutton ID="rdoUnload" runat="server" Text="Unload"
Checked="True" GroupName="MyGroup" OnClick="rdoUnload_Click>
</asp:radiobutton></td>

Cheers!

Claudi

Your unload button will only fire if you click it because that is what you
told it to do. It is already set as checked. Unless you click another
button to uncheck it and then re-click it, it will not fire the
rdoUnload_Click event.

Shelly
 
What unload button?!!??!?

I want to display the message box when I select the load button.

but is not working...

I try to select and deselect the buttons... but is not showing me the
message box..

Cheers!

Claudi
 
Back
Top