DataSet to OWC SpreadSheet

L

lparrotta

I’ve been running the OWC spreadsheet for a long time as a streamed server
file, but as the spreadsheets have gotten larger the load time has gotten too
long.

I’m interested in using your technique from Chapter 8 to stream only XML
data to the client. I’ve haven’t been able to put it together in my head yet
however.

I would like to fetch data from the code-behind Page_Load based on
QueryString Parameters, stream the DataSet string, and then reassemble the
data into the client-side spreadsheet.

From your book:
I got the PrepareStream function working well well (I can quickly
Response.Write the string in the page).
How does the CheckForData sub utilize the string generated by PrepareStream?
What does the CheckForData sub do?
How is the payload variable set and how is it used in the LoadXML javascript
function?

Thanks for all of your help and expertise.
 
A

Alvin Bruney [ASP.NET MVP]

It's been a while but if I remember correctly, the idea was that
checkfordata would write script to the page which would run everytime the
page loads checking for data - the input string. That's one part. The other
part is the dataset. I strip it down to just the raw data so that it is
lighter than XML, remove any quotes in the data because javascript doesn't
like that. I use a for loop to flatten the dataset into a single string with
delimiters that mark the end of a row and the end of a column in each row.
The long string is put inside the response.write method and shipped to the
client. I haven't run into any size limitations for that string and was able
to load 20k rows by 15 columns of data in 3 - 4 seconds.

At this point, checkfordata kicks in, if it sees a string the javascript
routine parses the string pulling out the delimiters and assembling rows and
columns. At this point, I add formatting if necessary and load the data.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
 
L

lparrotta

I modified your technique slightly to eliminate some of the portions that I
did not understand (CheckForData).

The PrepareStream subroutine runs server-side to convert the dataset to a
string. I then use the RegisterStartupScript method to embed the data string
as an argument in the call to the JavaScript code.

On the client, I was having a problem getting the XML syntax right. Instead
of using the LoadXML method that you suggest, I’m writing the values direct
to the spreadsheet cells as I loop through and parse the data string.

It seems to be working well.

Thanks for your help.

--
Lou P


Alvin Bruney said:
It's been a while but if I remember correctly, the idea was that
checkfordata would write script to the page which would run everytime the
page loads checking for data - the input string. That's one part. The other
part is the dataset. I strip it down to just the raw data so that it is
lighter than XML, remove any quotes in the data because javascript doesn't
like that. I use a for loop to flatten the dataset into a single string with
delimiters that mark the end of a row and the end of a column in each row.
The long string is put inside the response.write method and shipped to the
client. I haven't run into any size limitations for that string and was able
to load 20k rows by 15 columns of data in 3 - 4 seconds.

At this point, checkfordata kicks in, if it sees a string the javascript
routine parses the string pulling out the delimiters and assembling rows and
columns. At this point, I add formatting if necessary and load the data.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
-------------------------------------------------------


lparrotta said:
I’ve been running the OWC spreadsheet for a long time as a streamed server
file, but as the spreadsheets have gotten larger the load time has gotten
too
long.

I’m interested in using your technique from Chapter 8 to stream only XML
data to the client. I’ve haven’t been able to put it together in my head
yet
however.

I would like to fetch data from the code-behind Page_Load based on
QueryString Parameters, stream the DataSet string, and then reassemble the
data into the client-side spreadsheet.

From your book:
I got the PrepareStream function working well well (I can quickly
Response.Write the string in the page).
How does the CheckForData sub utilize the string generated by
PrepareStream?
What does the CheckForData sub do?
How is the payload variable set and how is it used in the LoadXML
javascript
function?

Thanks for all of your help and expertise.
 
A

Alvin Bruney [ASP.NET MVP]

Yes that will work however setting cells one at a time will be slower than
csvdata load. Bear that in mind if performance starts to become an issue.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
-------------------------------------------------------


lparrotta said:
I modified your technique slightly to eliminate some of the portions that
I
did not understand (CheckForData).

The PrepareStream subroutine runs server-side to convert the dataset to a
string. I then use the RegisterStartupScript method to embed the data
string
as an argument in the call to the JavaScript code.

On the client, I was having a problem getting the XML syntax right.
Instead
of using the LoadXML method that you suggest, I’m writing the values
direct
to the spreadsheet cells as I loop through and parse the data string.

It seems to be working well.

Thanks for your help.

--
Lou P


Alvin Bruney said:
It's been a while but if I remember correctly, the idea was that
checkfordata would write script to the page which would run everytime the
page loads checking for data - the input string. That's one part. The
other
part is the dataset. I strip it down to just the raw data so that it is
lighter than XML, remove any quotes in the data because javascript
doesn't
like that. I use a for loop to flatten the dataset into a single string
with
delimiters that mark the end of a row and the end of a column in each
row.
The long string is put inside the response.write method and shipped to
the
client. I haven't run into any size limitations for that string and was
able
to load 20k rows by 15 columns of data in 3 - 4 seconds.

At this point, checkfordata kicks in, if it sees a string the javascript
routine parses the string pulling out the delimiters and assembling rows
and
columns. At this point, I add formatting if necessary and load the data.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
-------------------------------------------------------


lparrotta said:
I’ve been running the OWC spreadsheet for a long time as a streamed
server
file, but as the spreadsheets have gotten larger the load time has
gotten
too
long.

I’m interested in using your technique from Chapter 8 to stream only
XML
data to the client. I’ve haven’t been able to put it together in my
head
yet
however.

I would like to fetch data from the code-behind Page_Load based on
QueryString Parameters, stream the DataSet string, and then reassemble
the
data into the client-side spreadsheet.

From your book:
I got the PrepareStream function working well well (I can quickly
Response.Write the string in the page).
How does the CheckForData sub utilize the string generated by
PrepareStream?
What does the CheckForData sub do?
How is the payload variable set and how is it used in the LoadXML
javascript
function?

Thanks for all of your help and expertise.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top