我想将GridView中的数据修改(将第三列变成汉字)后,导出到Excel中。但是最后总是变成乱码,而且,我如果不用循环,只改变其中一行的数据,就可以正常导出
不知道怎么解决,请各位大大帮帮忙,谢啦!!下面是我写的代码:        GridView dgd = new GridView();        //ds是之前定义的DataSet,已经Fill过了
        dgd.DataSource = ds;
        dgd.DataBind();
        
        //编辑其中字段
        int i = 0;
        while(i < dgd.Rows.Count-2)
        {
            /****************问题发生区域****************/
            dgd.Rows[i].Cells[2].Text = "蓝牌";
            i++;
            /******************************************/
        }
        
        //导出为Excel
        Response.Clear();
        Response.AddHeader("content-disposition", "attachment; filename=MyExcelFile.xls");
        Response.Charset = "UTF8";
        Response.ContentEncoding = System.Text.Encoding.Default;
        Response.ContentType = "application/excel";        StringWriter sw = new StringWriter();
        HtmlTextWriter htw = new HtmlTextWriter(sw);
        dgd.RenderControl(htw);
        Response.Write(sw.ToString());
        Response.End();