jobojo 0 Light Poster

Learning about asp.net slowly, but surely. I have a question for those much more experienced than I. How do I make one of the items in my checkboxlist automatically selected upon page load? The items in my checkboxlist come from a SQL DB and I want one of the fields to be automatically selected. I have found many simple solutions to this question if I was not retrieving my checkboxlist items from a Database, but I am having trouble figuring out how to do this based on my situation. Any help would be greatly appreciated.

Here is my code for my 2 relevant pages:

ALCounties.aspx.vb

Imports System.Collections.Generic

Partial Class ALCounties
Inherits System.Web.UI.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim chkValues As Dictionary(Of String, Double) = _
        New Dictionary(Of String, Double)


    For Each Item As ListItem In CheckBoxList1.Items
        If (Item.Selected) Then
            If (Not Item.Value Is Nothing And Not String.IsNullOrEmpty(Item.Value())) Then
                chkValues(Item.Text.ToString) = Convert.ToDouble(Item.Value)
            Else
                chkValues(Item.Text.ToString) = 0
            End If

        End If
    Next Item

    Session("CheckedItems") = chkValues
    Response.Redirect("Cart.aspx")
End Sub
End Class

ALCounties.aspx

<asp:CheckBoxList ID="CheckBoxList1" runat="server" 
                DataSourceID="SqlDataSource1" DataTextField="AL_County" 
                DataValueField="AL_Fee">
            </asp:CheckBoxList>
       </div>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server"        ConnectionString="<%$ ConnectionStrings:advancedleadsConnectionString %>" 
                SelectCommand="SELECT [AL_Fee], [AL_County]  FROM [AL]">   </asp:SqlDataSource>

        <p>&nbsp;</p>
        
        <asp:Button ID="Button1" runat="server" Text="Submit" />
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.