protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string myQuery = "select * from studentDetail"; cmd = new SqlCommand(myQuery, conn); cmd.Connection = conn; SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = cmd; DataSet ds = new DataSet(); sda.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); int hasRows = ds.Tables[0].Rows.Count; int c = 0; if(c< hasRows){ DropDownList1.Items.Add(ds.Tables[0].Rows[c]["rollnum"].ToString()); c++; } conn.Close(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)