Posted on: 10/31/2012 1:42:24 AM | Views : 231

I have a Dropdownlist in a Gridview and i have to show the records associated with every id.And the ID contains more than 10 records so how can i show them??
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { con.Open(); var ddl = (DropDownList)e.Row.FindControl("DropDownList1"); //int CountryId = Convert.ToInt32(e.Row.Cells[0].Text); SqlCommand cmd = new SqlCommand("select LastName from Profile_Master", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); con.Close(); ddl.DataSource = ds; ddl.DataTextField = "LastName"; ddl.DataBind(); } }
...

Go to the complete details ...