Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8516737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:30:51+00:00 2026-06-11T05:30:51+00:00

Like I wrote in the title, the code-behind gets the wrong value when I

  • 0

Like I wrote in the title, the code-behind gets the wrong value when I try to change the selection of a RadioButton.

Dilemma.aspx:

<asp:RadioButtonList ID="rbList" runat="server">
    <asp:ListItem Text="Yes, please." />
    <asp:ListItem Text="No, thanks." />
    <asp:ListItem Text="Ummm... maybe." />
</asp:RadioButtonList>
<asp:Button ID=""btnChoose" runat="server" text="OK" OnClick="btnChoose_Click" />

Dilemma.aspx.cs:

protected void Page_Load(object sender, EventArgs e)
{
    int initialIndex = GetInitialIndex(); // Simplified for sake of question.
    rbList.SelectedIndex = initialIndex; // This works.
}

protected void btnChoose_Click(object sender, EventArgs e)
{
    int selection = rbList.SelectedIndex; // This gets it wrong!
}

Instead of getting the newly-selected RadioButton, the code-behind still believes that the selected index is the initial index.

Why?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T05:30:53+00:00Added an answer on June 11, 2026 at 5:30 am
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            int initialIndex = GetInitialIndex(); // Simplified for sake of question.
            rbList.SelectedIndex = initialIndex; // This works.
        }
    }
    

    Somebody posted this answer, but deleted it for some reason.
    Whoever it is who posted this answer before me – it works!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

like in title:) I wrote from tutorial: http://msdn.microsoft.com/en-us/wp7trainingcourse_yourfirstwp7applab_topic3 does everything like there. my code:
Database is like: table book: book_id, title table wrote: book_id, author_id, author_order table author:
I updated my code like Andro wrote about to me: public class ZiiziiActivity extends
i added sharekitkit my project. And wrote code like here : SHKItem *item =
I wrote following code...but i am getting Error like: Error 1 'LoginDLL.Class1.Login(string, string, string)':
I wrote this code app = Tk() app.title('Myapp') app.geometry('260x100+50+50') labelText =StringVar() labelText.set('Insert the version
I wrote the code in PHP like this and I need to delete the
I wrote following code: class node: def __init__(self, title, series, parent): self.series = series
So like i wrote in the title, i have multiple elements with same class
I wrote code like: + (CGFloat)tableView:(UITableView*)tableView rowHeightForObject:(id)item { CustomTTTableSubtitleItem* captionedItem = item; CGFloat maxWidth

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.