0
            {
                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 :/

3
Contributors
3
Replies
4
Views
4 Years
Discussion Span
Last Post by k.d.m
0

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

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.