Posted on: 9/10/2012 8:22:30 AM | Views : 194

I am havinh 10 dropdownlist control .In that i am retreiving  items form the database.(All the 10 drpdownlist has the same items)
in the bindDropdownList()methos i have written a code like this
public void binddropdownCountry() { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString.ToString().Trim()); con.Open(); SqlCmd = new SqlCommand("sp_dropdowncountry", con); SqlCmd.CommandType = CommandType.StoredProcedure; Ds = new DataSet(); Ds.Clear(); da = new SqlDataAdapter(SqlCmd); da.Fill(Ds); con.Close(); for (int i = 1; i <= 30; i++) { DropDownList drp1 = Page.FindControl("ddlCountry" + i.ToString()) as DropDownList; if (!IsPostBack) { drp1.DataSource = Ds; drp1.DataValueField = "sno"; drp1.Dat ...

Go to the complete details ...