Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Reading Text File

$
0
0

Hi,

I about us text file in the root folder of my web site and also I about page in asp.net I would like to show the content of text file into my About page so time to time if make changes in the file it automatically update my About page in my text file I have an image also. I used the GridView but it shows me the item,

Any help would be appreciate.

<div><asp:GridView ID="GridView1" runat="server" Visible="True"></asp:GridView></div>
   //  Declarations
            StreamReader objStreamReader = new StreamReader(Server.MapPath("About.txt"));
            ArrayList arrText = new ArrayList();
            //  Loop through the file and add each line to the ArrayList
            while ((objStreamReader.Peek() >= 0))
            {
                arrText.Add(objStreamReader.ReadLine());
            }
            //  Close the reader
            objStreamReader.Close();
            //  Bind the results to the GridView
            GridView1.DataSource = arrText;
            GridView1.DataBind();




Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>