#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0

    RadioButtonList populated with xmlDataSource


    Hi. This is my first post and also quite new to .NET.

    I have a radioButtonList which is populated with an xmlDataSource. The data source is variable. I set it in my codebehind. My trouble is that I then need to know the Items.Count of the RadioButtonList and it is showing as Zero. I need to know the count because I loop through the radioButtonList to enable or disable the buttons.

    Here is the radioButtonList:

    PHP Code:
    <asp:RadioButtonList ID="dslRadioButtonList" runat="server" RepeatDirection="Horizontal" CssClass="hide-rb" AutoPostBack="True">
                            </
    asp:RadioButtonList
    Here is the codebehind setting the xmlDataSource:

    PHP Code:
        Private Sub setDslXml(site As String)

            
    dslRadioButtonList.CssClass "show-rb"
            
    If site "0003" Then
                With dslRadioButtonList
                    
    .DataSourceID "dslDataSource"
                    
    .DataTextField "text"
                    
    .DataValueField "value"
                
    End With
                dslDataSource
    .DataFile "~/dslmi.xml" 
                
    dslDataSource.DataBind()
            Else
                
    With dslRadioButtonList
                    
    .DataSourceID "dslDataSource"
                    
    .DataTextField "text"
                    
    .DataValueField "value"
                
    End With
                dslDataSource
    .DataFile "~/dsl2.xml"
                
    dslDataSource.DataBind()
            
    End If
            
    Dim countbuttons dslRadioButtonList.Items.Count

        End Sub 
    I appreciate any help!

    E
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0
    Well, nothing like posting your first question and then figuring it out 5 minutes later!

    I changed:

    dslDataSource.DataBind()

    to

    dslRadioButtonList.DataBind()

    Works much better.

    E

IMN logo majestic logo threadwatch logo seochat tools logo