Click here to Skip to main content
15,885,925 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
con = new SqlConnection(cs);
            con.Open();


            string ct = "select distinct RTRIM(FeeID) from FeesDetails ";

            cmd = new SqlCommand(ct);
            cmd.Connection = con;

            rdr = cmd.ExecuteReader();

            while (rdr.Read())
            {
                DropDownList2.Items.Add(rdr[0]);

            }
            con.Close();
Posted
Comments
[no name] 23-Aug-14 16:04pm    
What error? Do you have a control DropDownList2 defined in your ASP.NET page?
Er Aslam Khan 23-Aug-14 16:09pm    
the best overload method for system. web.webUIcontrols.listItemsCollection.add(system. web.webUIcontrols.listItem) has some invalid argument
[no name] 23-Aug-14 16:21pm    
try DropDownList2.Items.Add(rdr.GetString(0));
Er Aslam Khan 23-Aug-14 16:28pm    
it is working but add the string in dropdowm which will be select and increases

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900