473,387 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Datagrid export to excel only displays in white for unknown reason

I am populating a datagrid and outputting it to excel. Everything worked well last night, but today excel only displays the content in font color white, which is impossible to see.

The data is all there but invisible. I am unable to change any type of properties within excel to have the font color change. I have tried changing every attribute on the datagrid that I can think of, and I have also outputted to just a plain generic auto-generate columns datagrid with the same effect.

When i change the response.type from excel to html the datagrid displays fine in black print.

Any tips on how to change this output would be great, we're trying to get this to go live today.

Thanks!


Here is my HTML Code

Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="vb" AutoEventWireup="false" Codebehind="TimeReport.aspx.vb" Inherits="xxxx" %>
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  3. <HTML>
  4.     <HEAD>
  5.         <title>TimeReport</title>
  6.         <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
  7.         <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
  8.         <meta name="vs_defaultClientScript" content="JavaScript">
  9.         <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
  10.  
  11.     </HEAD>
  12.     <body bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0">
  13.         <form id="Form1" method="post" runat="server">
  14.             <asp:DataGrid ID="dataGrid"  AutoGenerateColumns=True runat=server></asp:DataGrid>
  15.         </form>
  16.     </body>
  17. </HTML>
  18.  
  19.  
  20.  

Here is the VB code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Page_Load()
  2.   Response.Clear()
  3.             Response.ContentType = "application/vnd.ms-excel"
  4.             Response.Charset = ""
  5.  
  6.             Dim dsExport As DataSet = getReportData(dateselect1, dateselect2)
  7.             dataGrid.DataSource = dsExport
  8.             dataGrid.DataBind()
  9.  
  10.  
  11.     End Sub
  12.  
  13.  
  14.     Private Function getReportData(ByVal d1 As Date, ByVal d2 As Date) As DataSet
  15.         Dim strConnection As String
  16.         Dim sqlCmd As SqlCommand
  17.         Dim ds As New DataSet
  18.         Dim da As SqlDataAdapter
  19.  
  20.         ' Dim sqlRetrieve As SqlCommand
  21.         Dim sqlConn As SqlConnection
  22.         Dim intTestCount As Integer
  23.         Try
  24.  
  25.             'connection string from Web Config
  26.             strConnection = ConfigurationSettings.AppSettings("ConnectionString")
  27.             sqlConn = New SqlConnection(strConnection)
  28.             sqlCmd = New SqlCommand("TimeTracker_ReportGenerate1", sqlConn)
  29.             sqlCmd.CommandType = CommandType.StoredProcedure
  30.                 sqlCmd.Parameters.Add("@dtDateRange1", d1)
  31.                 sqlCmd.Parameters.Add("@dtDateRange2", d2)
  32.  
  33.             sqlConn.Open()
  34.  
  35.             da = New SqlDataAdapter(sqlCmd)
  36.             da.Fill(ds)
  37.  
  38.         Catch ex As Exception
  39.             Response.Write(ex.ToString & "<br>")
  40.  
  41.         Finally
  42.             sqlConn.Close()
  43.         End Try
  44.  
  45.         Return (ds)
  46.  
  47.     End Function
  48.  
Jul 17 '06 #1
0 5255

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
1
by: Ugo | last post by:
Hi, I am having a problem exporting a Datagrid to excel in asp.net. For some reason I am getting a blank excel page. I set up in IIS the Mime for ..xls. My code is below any help would be...
1
by: Kevin Blakeley | last post by:
I know this was just posted but I did not want this message to get lost in the other thread as it's slightly different. Yes I want to export my dataset to excel for my clients, but I don't want...
0
by: Dave | last post by:
In a VB.NET application, I have a datagrid that I export to an Excel spreadsheet like this: ' Set the content type to Excel Response.ContentType = "application/vnd.ms-excel" Dim tw As New...
1
by: Luis Esteban Valencia | last post by:
Here is my aspx code: ============= <%@ Page language="c#" Codebehind="WebForm3.aspx.cs" AutoEventWireup="false" Inherits="PDM.excel.WebForm3" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0...
0
by: optimizeit | last post by:
What I am attempting to do is import an Excel Workbook and display the worksheets in a datagrid dynamically. I am very close to getting this to work. I have to this point successfully imported a...
4
by: Amirallia | last post by:
Hello Here's my code to export a datagrid to Exel : Response.Clear() Response.Buffer = True Response.ContentType = "application/vnd.ms-excel" Response.Charset = "" Dim monStringWriter As...
3
by: =?Utf-8?B?Sm9obiBXYWxrZXI=?= | last post by:
Hi, Is there anything wrong with the code below in sending my browser page to Excel? Before my page opens in Excel there's a message "Problems came up in the following areas during load:" and it...
6
by: slinky | last post by:
I found the following code to transfer datagrid data to an Excel file. Is this written in C#?... I'm a vb.netter. I'm just not sure where to place the code to experiment on it. Should I place it in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.