OWC10 and C# ASP .NET

Y

Yie

Hi, i trying to use a PivotTable in my asp .net page. I use a
webservice for control the pivottable object but when I connec the
ActiveView have an error. Somebody have an idea??? Somebody have a
sample of PivotTable in C# ASP????
Help me
 
D

Dan Ricker

Some more details about the code you are using and the
specific error would be helpful.

Just a general FYI:

OWC is not a "Web Control" as defined by VS.NET/ASP.NET.
It will not work with code-behind and be displayed on the
client at the same time.
 
M

MikeHolloway

Since most of us have our data in sqlserver and use
code_behind to get to the data, with all due respect,
what good are these "Web components"? I have seen very
few situations where the data resides on the client.
Sorry if this is blunt but I have become frustrated with
this issue. I have put my stock in Microsoft tools and
in this area I have been very let down. You wouldn't
think it would be such a big deal to read a Microsoft
database on a Microsoft server and display the data in a
Microsoft web component spreadsheet.
 
A

Alvin Bruney

I understand your frustration but there are strategies to accomplish just
that very easily.

Extract the data from sql and then stream it to the client once you set the
correct content type in the code behind.

another option would be to have a load function in client side which loads a
file from disc. your code behind would be responsible for populating the
contents of this file.

the option i've gone with for scalability reasons is to extract the data
from the datasource, build a string with formatting characters embedded
which tells me how to format the string, and stream this string to the page.
i then load that string from inside the page and read the formatting
instructions while loading.

Finally you can cause owc component to load directly from the datasource
itself by setting the appropriate string in the datasource tab of the
spreadsheet control. and you can manipulate that process clientside/server
side.

hope this helps
 
A

Alvin Bruney

it doesn't load from the datasource tab. i'm sorry, i do not believe that
was what i said. it loads in response to a server side button click.

i examine this technique in detail in my forthcoming website, here is a
preview:

javascript:
title = "some title"
var header = '<?xml version="1.0"?><ss:Workbook
xmlns:x="urn:schemas-microsoft-com:eek:ffice:excel"
xmlns:ss="urn:schemas-microsoft-com:eek:ffice:spreadsheet"
xmlns:c="urn:schemas-microsoft-com:eek:ffice:component:spreadsheet">
+<ss:Worksheet ss:Name="' + title + '"><ss:Table>';

//my data comes in streamed as string called payload, notice the delimiter
split

Rows = payLoad.split('|');

for(i = 0; i < Rows.length; i++)

{

target[index++] = "'<ss:Row>'";

if(Rows.toString() != "")

{

Cols = Rows.toString().split('^');

target[index++]= "'<ss:Cell></ss:Cell>'";

for(j = 0; j < Cols.length; j++)

target[index++]= "'<ss:Cell><ss:Data ss:Type='String'>" + Cols[j] +
"</ss:Data></ss:Cell>'";

target[index++]= "'<ss:Cell></ss:Cell>'";

}

target[index++]= "'</ss:Row>'";

}

This peice of javascript extracts the raw data streamed in and applies
formatting tags transforming the data to xml

document.all.sp.XMLDATA = (header + target.join('') +
"'</ss:Table></ss:Worksheet></ss:Workbook>'");

This will load the data correctly formatted into the spreadsheet. This is
all happening client side. Remember, the data has come from the server side.
Here is the code which takes a dataset and transforms it into a payload
string



C-sharp

//build the data

string StartStreamDelimiter = "|";

string EndStreamDelimiter = "^";

strTempString.Append(StartStreamDelimiter);

for(int i = 0; i < dSet.Tables[0].Rows.Count; i++)

{

foreach(DataColumn myCol in dSet.Tables[0].Columns)

{

strTempString.Append(dSet.Tables[0].Rows[myCol].ToString().Trim());

strTempString.Append(EndStreamDelimiter);

}

strTempString.Append(StartStreamDelimiter);

}

strTempString.Replace("'","");

This comes in from the server side. All you have to do now is stream it out
to the page.



Regards
 

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