Click here to Skip to main content
16,006,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a txt file

1,Labour
2,Interviewer

I want to put this in dropdown list

Posted

This forum thread should help you - How to populate a dropDownList from a text file[^].
 
Share this answer
 
try this.. :)

C#
List<string> usernames = new List<string>();
        usernames = File.ReadAllLines(@"E:\raju.txt").Select(x => x.Split('_')[0]).ToList();
        foreach (var user in usernames)
        {
            ddl.Items.Add(user);
            //Response.Write(user);
        }
</string></string>


How to populate a dropDownList from a text file RSS[^]

How to fill combobox with text file item![^]

Combobox Items From A Text File[^]
 
Share this answer
 

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