stevekarachi
New Member
I have a drop list in gridview In which i am selecting a data in dropdown list from database like this\[code\]AdeelAkramAliAsifZeeshan\[/code\]Problem Is that when gridview loads for example with 5 rows for data inserting the data shows in drop down is sorted in such a way the on each row first element is adeel but i want to sort the names according row For Example In first row the element should show as adeel and in second row value should show as Akram and so on.Below is my code in which i am using to load griview for data inserting\[code\] For Each gvRow As GridViewRow In GridView1.Rows Dim ddlEmpCode As DropDownList = CType(gvRow.FindControl("DropDownlist1"), DropDownList) Dim con As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("DatabaseConnectionString2").ConnectionString) Dim cmd As SqlCommand = New SqlCommand("insert into Status(m_date,emp_code) values (@m_Date,@EMp_Code)", con) cmd.Parameters.Clear() cmd.Parameters.AddWithValue("m_Date", txtdate.Text) cmd.Parameters.AddWithValue("Animal_Code", ddlAnimalCode.SelectedValue) con.Open() cmd.ExecuteNonQuery() con.Close() Label1.Text = "All Records are Saved Successfully" btnInsert.Enabled = False Next\[/code\]