filter status by dropdownlist

I have a table that has tblcheck for active for true false in database sql server. I need to add a dropdown  that will only show actives my default on page load, dropdown will have active and inactive. so, basically on page load i will see all actives from database which value = true. how can i do that on c# on web dev.
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.

Ajay SharmaCommented:
what i got from your question that, you want to show database column values in a dropdownlist where some value is defined as  true.

So lets assume the the column u want to show is cActivity and status column's name is cStatus.

    Dim myConnection As SqlConnection
    Dim oblV As New vbGlobalMethods
    Dim connStr As String = "your connection string goes here"

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    If Page.IsPostBack = False Then

End Sub

Private Sub fillCmbCity()


            Dim dr As SqlDataReader
            Dim comm As SqlCommand
            myConnection = New SqlConnection(ConnStr)
            Dim sql As String
            sql = "select cActivity from tblActivity where cStatus='true' order by uCityName asc"
            comm = New SqlCommand(sql, myConnection)
            dr = comm.ExecuteReader
            While dr.Read
            End While
        Catch ex As Exception
            lblMessage.Text = ex.Message

        End Try
    End Sub

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
Bob LearnedCommented:
You could use a DataView, with a RowFilter set to the condition from the DropDownList, and bind to the DataView.
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.