radio button

Discussion in 'ASP .Net' started by Claudia Fong, Sep 26, 2007.

  1. Claudia Fong

    Claudia Fong Guest

    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

    *** Sent via Developersdex http://www.developersdex.com ***
    Claudia Fong, Sep 26, 2007
    #1
    1. Advertising

  2. Claudia Fong

    md Guest

    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.

    "Claudia Fong" <> wrote in message
    news:%...
    > 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
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    md, Sep 26, 2007
    #2
    1. Advertising

  3. Claudia Fong

    Claudia Fong Guest

    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

    *** Sent via Developersdex http://www.developersdex.com ***
    Claudia Fong, Sep 26, 2007
    #3
  4. Claudia Fong

    Shelly Guest

    "Claudia Fong" <> wrote in message
    news:...
    > 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
    Shelly, Sep 26, 2007
    #4
  5. Claudia Fong

    Claudia Fong Guest

    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

    *** Sent via Developersdex http://www.developersdex.com ***
    Claudia Fong, Sep 26, 2007
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Scott D Johnson
    Replies:
    1
    Views:
    1,062
    Scott D Johnson
    Sep 27, 2006
  2. Jan C. Faerber
    Replies:
    0
    Views:
    617
    Jan C. Faerber
    Jun 30, 2009
  3. tshad
    Replies:
    6
    Views:
    6,958
    Alexey Smirnov
    Nov 26, 2009
  4. Martin
    Replies:
    8
    Views:
    3,337
    Jan C. Faerber
    Nov 24, 2009
  5. Hiten
    Replies:
    1
    Views:
    616
    Vidar Petursson
    May 26, 2004
Loading...

Share This Page