Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
SqlCommand CMD = new SqlCommand("select productname from addproduct", con); dr = CMD.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { DropDownList drp = new DropDownList(); drp.Items.Add(dr.GetValue(0).ToString()); for (int i = 0; i <= drp.Items.Count; i++) { //getting above error at below line GridView1.Rows[i].Cells[1].Text = dr.GetValue(0).ToString();
for (int i = 0; i < drp.Items.Count; i++) {
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)