SelectedIndex when populating RadioButtonList

SelectedIndex when populating RadioButtonList

Old forum URL: forums.lhotka.net/forums/t/6974.aspx


Joentje posted on Wednesday, May 20, 2009

Hi there,

A beginner question: where is the best place to select the default item in a RadioButtonList that is populated by a CslaDataSource?

I have a page with two radio button lists, each populated by its own CslaDataSource. The second list is being populated and shown after the user selects an item in the first list. My problem is, I want both lists to have the first item selected initially, but where do I put that code?

I have the dsList1_SelectObject where I could set the initial value for the first list, but I think a binding method is not the right place to do that?

I have the List1_SelectedIndexChanged where the second RadioButtonList is made visible and after that the DataBind is called for that second list. I think this is the right place to handle this dependency between the two radio button lists?

I have the dsList2_SelectObject where the second list is being populated with data depending on the selected value in the first list. Now I want to select the first item in the second list as the default item. Again, maybe this binding method is not the right place to do this?

Thank you very much for your help!

Kind regards, Jeroen

Copyright (c) Marimer LLC