Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Two RadioButtonList.SelectedIndex Values Changed Simultaneously - What am I Doing Wrong?

Two RadioButtonList.SelectedIndex Values Changed Simultaneously - What am I Doing Wrong?

Scheduled Pinned Locked Moved Visual Basic
visual-studiocsharpdatabasesysadmindebugging
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    johnaparker
    wrote on last edited by
    #1

    I'm using Visual Studio 2008 to develop a web site for my daughter's softball league. In one page I have two RadioButtonLists in the same panel in their own table cells. I programatically build the RBLs and determine the initial selected index values for each. The behavior I'm seeing is as follows: 1. I sucessfully change the first selected index from its cleared state (-1) to the value I calculated. The second RBL remains in its clear state (as it should). 2. I then set the second RBL's selected index. While its value is correctly set, the first RBL's selected index is also altered to the same value simulataneously. I've stepped through with the VS debugger and watched these two steps occur as described. Is this a known faux pas on my part? If so what have I done wrong? Otherwise, has anyone else seen similar behavior? I'm not sure what to include here so I'll probably provide too much of some detail and not enough of other, but I'll gladly provide the entire aspx file (imbedded VB script plus a common function VB scrip "include") and/or screen captures of the variable states as I stepped through the code, if any of these would be of use. Please don't make fun of my choice of style! PLEASE NOTE: Even though I'm including the related event handler routines, the erroneous behavior occurs on page load before any user selections are made. Detail below. Thanks in advance, John ######################################################################################### Page Content:

            <tr>
                <td>&nbsp;</td>
                <td align="left">
                    <asp:RadioButtonList ID="hTeamNameRBL" runat="server" Enabled="False" OnSelectedIndexChanged="selectedHomeTeamChanged" AutoPostBack="True"></asp:RadioButtonList>
                </td>
                <td>&nbsp;</td>
                <td align="left">
                    <asp:RadioButtonList ID="aTeamNameRBL" runat="server" Enabled="False" OnSelectedIndexChanged="selectedAwayTeamChanged" AutoPostBack="True"></asp:RadioButtonList>
                </td>
                <td>&nbsp;</td>
                <td align="left" valign="top">
                    <asp:RadioButtonList ID="fieldRBL" runat="server" Width="200px" style="text-align:left;" Enabled="False" OnSelectedIndexChanged="selectedFieldChanged" AutoPostBack="True"></asp:RadioButt
    
    P 1 Reply Last reply
    0
    • J johnaparker

      I'm using Visual Studio 2008 to develop a web site for my daughter's softball league. In one page I have two RadioButtonLists in the same panel in their own table cells. I programatically build the RBLs and determine the initial selected index values for each. The behavior I'm seeing is as follows: 1. I sucessfully change the first selected index from its cleared state (-1) to the value I calculated. The second RBL remains in its clear state (as it should). 2. I then set the second RBL's selected index. While its value is correctly set, the first RBL's selected index is also altered to the same value simulataneously. I've stepped through with the VS debugger and watched these two steps occur as described. Is this a known faux pas on my part? If so what have I done wrong? Otherwise, has anyone else seen similar behavior? I'm not sure what to include here so I'll probably provide too much of some detail and not enough of other, but I'll gladly provide the entire aspx file (imbedded VB script plus a common function VB scrip "include") and/or screen captures of the variable states as I stepped through the code, if any of these would be of use. Please don't make fun of my choice of style! PLEASE NOTE: Even though I'm including the related event handler routines, the erroneous behavior occurs on page load before any user selections are made. Detail below. Thanks in advance, John ######################################################################################### Page Content:

              <tr>
                  <td>&nbsp;</td>
                  <td align="left">
                      <asp:RadioButtonList ID="hTeamNameRBL" runat="server" Enabled="False" OnSelectedIndexChanged="selectedHomeTeamChanged" AutoPostBack="True"></asp:RadioButtonList>
                  </td>
                  <td>&nbsp;</td>
                  <td align="left">
                      <asp:RadioButtonList ID="aTeamNameRBL" runat="server" Enabled="False" OnSelectedIndexChanged="selectedAwayTeamChanged" AutoPostBack="True"></asp:RadioButtonList>
                  </td>
                  <td>&nbsp;</td>
                  <td align="left" valign="top">
                      <asp:RadioButtonList ID="fieldRBL" runat="server" Width="200px" style="text-align:left;" Enabled="False" OnSelectedIndexChanged="selectedFieldChanged" AutoPostBack="True"></asp:RadioButt
      
      P Offline
      P Offline
      pdnet
      wrote on last edited by
      #2

      at the 1st line of the Procedure "selectedHomeTeamChanged" Check for If not page.isPostBack=true Then '''''' write your code''''''''' End If

      Arindam Banerjee Sr. Software Developer Rance Computer Pvt Ltd. Kolkata (India)

      J 1 Reply Last reply
      0
      • P pdnet

        at the 1st line of the Procedure "selectedHomeTeamChanged" Check for If not page.isPostBack=true Then '''''' write your code''''''''' End If

        Arindam Banerjee Sr. Software Developer Rance Computer Pvt Ltd. Kolkata (India)

        J Offline
        J Offline
        johnaparker
        wrote on last edited by
        #3

        Hi Arindam. Thanks very much for your reply. I tried your suggestion w/o success. I did so even I saw (by stepping through with the debugger) the errant behavior occur on and between the two distinct "steps": 1. aTeamNameRBL.SelectedIndex = aTeamSelected 2. hTeamNameRBL.SelectedIndex = hTeamSelected If it would be of use to anyone I have screen captures showing the fact that after step 1. is executed, the SelectedIndex of both RadioButtonList's are set to the "aTeamSelected" value, and then after step 2. both are set to the "hTeamSelected" value. Also, I'd be happy to grab whatever additional debug detail you might suggest. As I've seen Visueal Studio occasionally wrap itself around the axle and not register the fact changes have been made I also tried... a. Deleting and recreating the RBLs b. Deleting the RBs, saving the file, closing the project and then recreating them c. Renaming them None of these attemps made any difference. As soon as the first RBL was adjusted, the second was as well, and vice-versa. HELP!!!!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups