{
                conOOC.Open();
                SqlCommand cmdDisplay = new SqlCommand("SELECT * FROM [Course] WHERE ([CourseID] = @id)", conOOC);
                cmdDisplay.Parameters.AddWithValue("@id", ddlCourseList.SelectedValue);
                SqlDataReader dtrDisplay = cmdDisplay.ExecuteReader();

                while (dtrDisplay.Read())
                {
                    GridView1.DataSource = dtrDisplay;
                    GridView1.DataBind();
                }

this one is depends on user select which items on the dropdownlist, once they have selected should display the gridview, but the girdview doesn't show anything :/

Are you reloading the page after the databind?

yes, the the dropdownlist is enable autopostback. i got put if postback.

Try to use datatable or dataset. Since you are using datareader it is readonly and forward way of reading one roe of data at a time.

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.