C# write to text file from gridview error

Posted on 2012-08-21
Last Modified: 2012-08-22
Hi - Im trying to write to a text file froma  gridview using the follwing code but get the error message at the bottom --

protected void Button2_Click(object sender, EventArgs e)
        String strDestinationFile;
        strDestinationFile = "C:\\output.txt";
        TextWriter tw = new StreamWriter(strDestinationFile);

        //writing the header
        for (int x = 0; x < GridView1.Columns.Count; x++)
            if (x != GridView1.Columns.Count - 1)
                tw.Write(", ");


        //writing the data
        for (int x = 0; x < GridView1.Rows.Count - 1; x++)
            for (int y = 0; y < GridView1.Columns.Count; y++)
                if (y != GridView1.Columns.Count - 1)
                    tw.Write(", ");


CS1061: 'System.Web.UI.WebControls.TableCellCollection' does not contain a definition for 'Value' and no extension method 'Value' accepting a first argument of type 'System.Web.UI.WebControls.TableCellCollection' could be found (are you missing a using directive or an assembly reference?)
Question by:owenja
    1 Comment
    LVL 20

    Accepted Solution

    Should be Text instead of Value


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
    Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
    This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
    Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now