473,287 Members | 1,515 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,287 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 5250

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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.