473,386 Members | 1,720 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,386 software developers and data experts.

Freeze Cells

I am displaying the contents of a dataset to my customer
as an excel spreadsheet and giving them the opportunity to
save the spreadsheet to their local machine. The
spreadsheet has approx 650 rows and 75 columns. The
following code works fine (without the two lines following
the response.end), as far as generating the spreadsheet,
but I added those two lines (the ActiveWindow lines)to try
to freeze the first row so that the headers are always
visible.

I need to do this or flip my columns and rows. Any help
will be appreciated.

Thanks

Jack

Imports System.Data.OleDb
Imports Excel.ApplicationClass
Public Class MSView
Inherits System.Web.UI.Page
Protected WithEvents Label1 As
System.Web.UI.WebControls.Label
Protected WithEvents btnView As
System.Web.UI.WebControls.Button
Protected WithEvents OleDbSelectCommand1 As
System.Data.OleDb.OleDbCommand
Protected WithEvents cnMasterSched As
System.Data.OleDb.OleDbConnection
Protected WithEvents daMasterSched As
System.Data.OleDb.OleDbDataAdapter
Protected WithEvents dsMasterSched As
MasterSchedule2003.dsMasterSched
Protected WithEvents dgMS As
System.Web.UI.WebControls.DataGrid
Dim dsMSched As DataSet
#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Dim configurationAppSettings As
System.Configuration.AppSettingsReader = New
System.Configuration.AppSettingsReader()
Me.cnMasterSched = New
System.Data.OleDb.OleDbConnection()
Me.daMasterSched = New
System.Data.OleDb.OleDbDataAdapter()
Me.OleDbSelectCommand1 = New
System.Data.OleDb.OleDbCommand()
Me.dsMasterSched = New
MasterSchedule2003.dsMasterSched()
CType(Me.dsMasterSched,
System.ComponentModel.ISupportInitialize).BeginIni t()
'
'cnMasterSched
'
Me.cnMasterSched.ConnectionString
= "Provider=OraOLEDB.Oracle.1;Persist Security
Info=False;User ID=master_schedule;Da" & _
"ta Source=ftest920;Extended Properties="""""
'
'daMasterSched
'
Me.daMasterSched.AcceptChangesDuringFill = CType
(configurationAppSettings.GetValue
("daMasterSched.AcceptChangesDuringFill", GetType
(System.Boolean)), Boolean)
Me.daMasterSched.SelectCommand =
Me.OleDbSelectCommand1
Me.daMasterSched.TableMappings.AddRange(New
System.Data.Common.DataTableMapping() {New
System.Data.Common.DataTableMapping("Table", "Table", New
System.Data.Common.DataColumnMapping(-1) {})})
'
'OleDbSelectCommand1
'
Me.OleDbSelectCommand1.CommandText = "SELECT" &
Microsoft.VisualBasic.ChrW(13) & Microsoft.VisualBasic.ChrW
(10) & " DIR_MASTER.*" & Microsoft.VisualBasic.ChrW(13)
& Microsoft.VisualBasic.ChrW(10) & "FROM" &
Microsoft.VisualBasic.ChrW(13) & Microsoft.VisualBasic.ChrW
(10) & " DIR_MASTER" & Microsoft.VisualBasic.ChrW(13) &
Microsoft.VisualBasic.ChrW(10)
Me.OleDbSelectCommand1.Connection =
Me.cnMasterSched
'
'dsMasterSched
'
Me.dsMasterSched.DataSetName = "dsMasterSched"
Me.dsMasterSched.Locale = New
System.Globalization.CultureInfo("en-US")
Me.dsMasterSched.Namespace
= "http://www.tempuri.org/dsMasterSched.xsd"
CType(Me.dsMasterSched,
System.ComponentModel.ISupportInitialize).EndInit( )

End Sub

Private Sub Page_Init(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web
Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Dim ActiveWindow As Excel.Window
Dim strsql As String
Dim dgMS As New DataGrid()
Dim cnMasterSched As New OleDbConnection(Session
("ConnectionString"))
Try
cnMasterSched.Open()

strsql = "Select * from dir_master"
daMasterSched.SelectCommand = New OleDbCommand
(strsql, cnMasterSched)
daMasterSched.Fill(dsMasterSched)

Dim oView As New DataView(dsMasterSched.Tables
(0))
dgMS.DataSource = oView
dgMS.DataBind()
Me.btnView.Visible = False
Response.ContentType = "application/vnd.ms-
excel"
Response.Charset = ""
Me.EnableViewState = False

Dim tw As New System.IO.StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
dgMS.RenderControl(hw)
Response.Write(tw.ToString())

Response.End()
ActiveWindow.RangeFromPoint("A1", "A1")
ActiveWindow.FreezePanes = True

Catch err As System.SystemException

Finally
If cnMasterSched.State = ConnectionState.Open
Then
cnMasterSched.Dispose()
cnMasterSched = Nothing

End If
End Try
End Sub
Private Sub btnView_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btnView.Click

End Sub

Private Sub Page_Unload(ByVal sender As Object, ByVal
e As System.EventArgs) Handles MyBase.Unload
cnMasterSched.Dispose()
cnMasterSched = Nothing
End Sub
End Class

Nov 22 '05 #1
0 1285

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

Similar topics

11
by: Matt Kruse | last post by:
This is a common requirement - "freeze panes" in a table, so that some header rows and some columns on the left are frozen while the body content scrolls. This makes large tables more usable on...
2
by: aww91 | last post by:
Company is planning a Sybase to UDB migration that is projected to take 1 year. During that long period of time any Code Freeze put into place would impact our users (we normally release code...
11
by: Timothy Shih | last post by:
Hi, I am having a freezing issue with my application. My application serves several remotable objects, all of which must be initialized before their use. Furthermore, some of them depend on each...
4
by: Roger Withnell | last post by:
I would like to freeze column and row headings on a webpage, simulating freeze panes as in an Excel spreadsheet. Don't seem to be able to do it with Frames. Is there a way with Javascript...
2
by: paraidy | last post by:
Hi all, i would to know how is possible to freeze another process from my application and unfreeze it, can someone help me? thx all.
1
by: jmalone | last post by:
I have a python script that I need to freeze on AIX 5.1 (customer has AIX and does not want to install Python). The python script is pretty simple (the only things it imports are sys and socket)....
1
by: Cameron Laird | last post by:
How is Freeze--freeze.py <URL: http://wiki.python.org/moin/Freeze >--packaged for Debian? *Is* it packaged for Debian?
4
by: ToxSox | last post by:
Hello. This is my first post here and i have a big problem with my script! One page (child.htm), was delivered not by me and i can't change it. This page calls a methode in a object of my page....
2
by: Gabriel Rossetti | last post by:
Hello everyone, I'm trying to use python's freeze utility but I'm running into problems. I called it like this : python /usr/share/doc/python2.5/examples/Tools/freeze/freeze.py...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.