.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Steve Jackman
Imran Ghani
Santhakumar Munuswamy

Home >> Code Snippets >> Design Patterns >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Read .txt file and fill contents is in dropdownlist using ASP.NET

Posted By:Athira Sreejith       Posted Date: February 22, 2009    Points: 5    Category: Design Patterns    URL: http://www.dotnetspark.com  

Read .txt file and fill contents is in dropdownlist using ASP.NET using System.Text; using System.IO; ddlCountry.Items.Clear(); StreamReader read = new StreamReader(MapPath(Request.ApplicationPath + "\\" + "Countries.txt")); string data; ddlCountry.Items.Add(new ListItem("----------------------------------Select Country--------------------------------","none")); while (!string.IsNullOrEmpty((data = read.ReadLine()))) { ddlCountry.Items.Add(new ListItem(data.Trim(), data.Trim())); }


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend