ASP.NET 1.1 RadioButtonList SelectedIndexChanged event not firing until RB in second RB List is clicked

I'm having a very strange problem with my ASP.NET 1.1 web app. I have two radio button lists, each have AutoPostBack="True", and each have event handlers attached to them. When each respective handler is called, I show/hide a panel of additional fields. The two radio button lists and the panels containing the additional fields are totally unrelated. When I click a radiobutton in either list, it looks like it's posting back, but then the newly selected value is not retained and the event handler is not triggered. When I then click a radio button in the second radio button list, the post back occurs and the event handlers are then triggered correctly upon subsequent clicks. It's very strange.

Thanks for your help!
First Radio Button List (Radio buttons added dynamically upon first page load - No - they're not reloaded upon postbacks as I check for this).
 
<asp:radiobuttonlist id="UnitClassRadioButtonList" runat="server" cssclass="selectionlist" repeatcolumns="3" AutoPostBack="True"></asp:radiobuttonlist>
 
Second Radio Button List:
 
<asp:radiobuttonlist id="ListingContactTypeRadioButtonList" runat="server" cssclass="selectionlist" repeatcolumns="3" AutoPostBack="True">
	<asp:ListItem Value="Owner" Selected="True">Owner</asp:ListItem>
	<asp:ListItem Value="Agent">Agent</asp:ListItem>
</asp:radiobuttonlist>
 
Handlers:
 
		private void UnitClassRadioButtonList_SelectedIndexChanged(object sender, EventArgs e)
		{
			Response.Write("Called event");
			if(this.UnitClassRadioButtonList.SelectedValue == GatewayWest.Common.BindableObjects.UnitClass.Rental)
			{
				this.SalePricePanel.Visible = false;
				this.RentPanel.Visible = true;
			}
			else
			{
				this.SalePricePanel.Visible = true;
				this.RentPanel.Visible = false;
			}
		}
 
		private void ListingContactTypeRadioButtonList_SelectedIndexChanged(object sender, EventArgs e)
		{
			Response.Write("Called event");
			if(this.ListingContactTypeRadioButtonList.SelectedValue == "Agent")
				this.BrokeragePanel.Visible = true;
			else
				this.BrokeragePanel.Visible = false;
		}

Open in new window

devvyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MaxOvrdrv2Commented:
hey,

i'm not sure about C#, BUT, in VBNet, the handlers MUST have the following:

private sub UnitClassRadioButtonList_SelectedIndexChanged(object sender, EventArgs e) HANDLES UnitCallRadioButtonList.SelectedIndexChanged

did you code the handlers yourself or let .Net do it for you??

this is the only reason i could see this happening... it doesn`t know which handler to call...
0
ITHelper80Commented:
What do you have in your page_load event?
0
ITHelper80Commented:
Try adding.
{
    if (!Page.IsPostback) {
    }
    //perform page load actions
}
0
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

williamcampbellCommented:
Can you post the aspx page there might be a spelling error
0
MaxOvrdrv2Commented:
it shouldn't matter as the function should be getting called in the end anyway...
0
devvyAuthor Commented:
I fixed it. The problem arose because of the way I was setting the form data upon the first load. I was setting the selected radio button by using:

this.UnitClassRadioButtonList.Items.FindByValue(this.Unit.UnitClass).Selected = true;

I guess that isn't the proper way to select the RB, because the selected index changed event handler wasn't firing. Once I changed it to:

this.UnitClassRadioButtonList.SelectedValue = this.Unit.UnitClass;

it started working fine. Damn Microsoft.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
williamcampbellCommented:
Yeah misread ..

So your saying the callbacks are not called until you have clicked a button in both Radio Button lists? It doesn't matter which order?

Rlist1 - No hadler  Rlist2 - Both handlers
Rlist2 - No Handler Rlist 1 - Both Handlers




0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.