radio button

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
 
M

md

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.
 
C

Claudia Fong

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
 
S

Shelly

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
 
C

Claudia Fong

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top