Re: OWC Events in .Net

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jeff Copeland (JeffCopeland_at_discussions.microsoft.com)
Date: 10/14/04


Date: Thu, 14 Oct 2004 10:27:05 -0700

Alvin,
Is there a way to reference mmy configuration.AppSettings from within
javascript? Write now I am throwing my connection string data into a hidden
field...I was wondering if I could just reference it directly?

"Alvin Bruney [MVP]" wrote:

> In that case, you can write the contents of the spreadsheet to the server
> disk. You will need to make sure that the file names are unique. When the
> user is ready for the file, re-load it using the xmldata property load. it
> should contain all the formulas etc and changes made by the user on the last
> save.
>
> --
> Regards,
> Alvin Bruney
> [ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
> Got tidbits? Get it here... http://tinyurl.com/27cok
> "Jeff Copeland" <JeffCopeland@discussions.microsoft.com> wrote in message
> news:DEEBF511-D1B0-4B82-BD12-F4A53DE1F5BC@microsoft.com...
> > Alvin,
> > k,thank you for helping...if you don't mind I will explain the 'app' that
> > I
> > am trying to develop and maybe you can steer me in the correct 'method'...
> > Our whole site is written in c# using .Net. We use classes, etc for
> > everything. We have a specific area we call calculators where we have
> > three
> > different forms that have form fields a user enters data into and they
> > click
> > on the calculate button which uses the form fieldse to make specific
> > calculations. When the user is finished they click on the save button
> > which
> > saves all of the form fields in the the database. Well all of the form
> > fields
> > and their calculations started from excel spreadsheets and from time to
> > time
> > these calculations change so we have to go back and recode the form...I
> > was
> > thinking that it would be so much easier if we could just use the original
> > spreadsheets within the web page. That is when I started looking at the
> > OWC
> > control. I want to save the spreadsheet files on the web server and also
> > save
> > some database info about each file (filename, user, etc). I think what
> > you
> > are telling me is that I will have to write javascript to work with the
> > spreadsheet and cannot use my C# code?...is this correct? So the best way
> > to
> > 'transfer' info from my c# code (database access, etc)...put it into
> > hidden
> > fields on the form?
> > Just trying to determine the best way to read-write the spreadsheet and
> > how
> > to get info from my c# code into the javascript routines...
> > Thanks...
> > "Alvin Bruney [MVP]" wrote:e]
> >
> >> the spreadsheet contains an xmldata property that you can use to write
> >> and
> >> read xml data.
> >> the spreadsheet can only read specially formatted xml data by the way.
> >> the export method exports the spreadsheet to the desktop
> >>
> >> --
> >> Regards,
> >> Alvin Bruney
> >> [ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
> >> Got tidbits? Get it here... http://tinyurl.com/27cok
> >> "Jeff Copeland" <JeffCopeland@discussions.microsoft.com> wrote in message
> >> news:76585310-54E9-4485-81DE-D2B2E9811742@microsoft.com...
> >> > Alvin,
> >> > k I will try this...But a question.. with this method I can't use any
> >> > of
> >> > my
> >> > c# routines for database activity, etc? I will be saving some 'header
> >> > info'
> >> > about the spreadsheet to my database...Also, when I write the
> >> > spreadsheet
> >> > and
> >> > need to pull it up, I don't need to store any specific detail in the
> >> > spreadsheet by col, row, etc. I just want to save it as a spreadsheet
> >> > and
> >> > pull it back up as a spreadsheet...can I save and read as xml or
> >> > something
> >> > like that? giving it a file path name, etc?
> >> > Thanks for helping
> >> >
> >> > "Alvin Bruney [MVP]" wrote:
> >> >
> >> >> You took a couple wrong turns. Events always work on the client. There
> >> >> is
> >> >> no
> >> >> need to go thru the event set up process. This is only needed for
> >> >> server-side applications. Basically, drag a spreadsheet component onto
> >> >> the
> >> >> webform. You will be responsible for writing javascript code to load
> >> >> and
> >> >> unload the control. The manipulation must be done from the client
> >> >> because
> >> >> it
> >> >> is a client control.
> >> >>
> >> >> For the unload process, place a text box on the form, set it's visible
> >> >> property to false. Put a webserver button on the form. Set its click
> >> >> event
> >> >> to a loadData function that you will write next.
> >> >>
> >> >> For the loadData function, unload the contents of the spreadsheet into
> >> >> the
> >> >> server textbox control. texdbox1.text = sp1.CSVDATA;
> >> >>
> >> >> The idea so far is that clicking on the webserver control will first
> >> >> execute
> >> >> the client side function that causes the spreadsheet to unload its
> >> >> contents
> >> >> to the textbox, then the webserver control will fire the page_load
> >> >> event
> >> >> followed by the button_click event on the server. Ignore the button
> >> >> click
> >> >> event. In your page_load event, test the contents of the textbox
> >> >> control
> >> >> and
> >> >> iterate its contents to extract the data.
> >> >> Here is the bulk of the code.
> >> >>
> >> >>
> >> >> Page_Load
> >> >>
> >> >> if(TextBox1.Text.Trim() != string.Empty)
> >> >> {
> >> >> string[] rows =
> >> >> TextBox1.Text.ToString().Split(Environtment.Newline);
> >> >> //or '\n'
> >> >> foreach(string str in rows)
> >> >> {
> >> >> string[] columns = rows.ToString().Split(',');
> >> >> foreach(string col in columns)
> >> >> {
> >> >> //collect your data per row here and do what you must
> >> >> }
> >> >> }
> >> >> //re-initialize
> >> >> TextBox1.Text = string.Empty;
> >> >> }
> >> >>
> >> >> Your load function follows roughly the same script idea, except that
> >> >> it
> >> >> loads data
> >> >> --
> >> >> Regards,
> >> >> Alvin Bruney
> >> >> [ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
> >> >> Got tidbits? Get it here... http://tinyurl.com/27cok
> >> >> "Jeff Copeland" <anonymous@discussions.microsoft.com> wrote in message
> >> >> news:3a6801c4afa8$3070ec90$a401280a@phx.gbl...
> >> >> > Alvin,
> >> >> > Can you point me in the right direction? I have spent
> >> >> > too much time on this and I want to get a working
> >> >> > solution.
> >> >> > I have been able to write some vbscript to SS1.Export
> >> >> > command for the spreadsheet but I want to do this via c#
> >> >> > code if possible...Also when I do the export command I am
> >> >> > always prompted if I want to save the file... is there a
> >> >> > way to supress this?
> >> >> > I want to control the spreadsheet via my c# code and not
> >> >> > have to use vbscript. Since I haven't been able to use
> >> >> > the online Doc to recompile the dll I don't know if that
> >> >> > will help me or not... Is there a way to just get a
> >> >> > compiled DLL sent to me? Frustrated...
> >> >> >>-----Original Message-----
> >> >> >>give me the exact error information and the line you
> >> >> > followed to get that.
> >> >> >>this needs to be corrected in the documentation and I
> >> >> > keep forgetting to
> >> >> >>submit it.
> >> >> >>
> >> >> >>the office web components are client-side controls. they
> >> >> > run on the client,
> >> >> >>not on the server. they do not have a handle on the
> >> >> > server so you will not
> >> >> >>be able to manipulate these controls from the server.
> >> >> > However, you can use
> >> >> >>attributes to attain some semblance of server-side
> >> >> > automation. Have a look
> >> >> >>at my website, it details some examples about the
> >> >> > process.
> >> >> >>http://tinyurl.com/27cok
> >> >> >>
> >> >> >>--
> >> >> >>Regards,
> >> >> >>Alvin Bruney
> >> >> >>[ASP.NET MVP
> >> >> > http://mvp.support.microsoft.com/default.aspx]
> >> >> >>Got tidbits? Get it here... http://tinyurl.com/27cok
> >> >> >>"WebComponentFlunky" <copeland573@sbcglobal.net> wrote
> >> >> > in message
> >> >> >>news:2c0d01c4ae04$7741ce00$a401280a@phx.gbl...
> >> >> >>>I am trying to add a spreadsheet component to my web
> >> >> > page
> >> >> >>> in .NET (c#). When I add the spreadsheet to my form I
> >> >> >>> cannot use its methods from within my .net code.
> >> >> >>> I found a Microsoft article #328275 'How to handle
> >> >> > events
> >> >> >>> for the Office Web Components in Visual Studio .NET'
> >> >> >>> which basically walks you through the process of
> >> >> >>> recompling a DLL which is part of the OWC controls...
> >> >> >>> when I tried these steps, I always get compilied errors
> >> >> >>> on step 11 (compile the source file, AxOWC10.cs). I
> >> >> > have
> >> >> >>> tried this on two different machines... same result...
> >> >> >>> I am just trying to get the spreadsheet control so
> >> >> > that I
> >> >> >>> can use its methods from my .net c# code... any ideas?
> >> >> >>>
> >> >> >>
> >> >> >>
> >> >> >>.
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>



Relevant Pages

  • Re: Help with Javascript, forms, frames
    ... > parameter (probably w/ another JavaScript in frameset.htm) ... > To pass form fields to other pages in frame see ... > | page that's used in 1/ a frameset for a few pages that pull in external ... This left nav page has a form which does a search ...
    (microsoft.public.frontpage.programming)
  • strange problem with form (capitalization etc.) on IE
    ... I am having some strange problems with some CGIs + javascript of mine with a particular client. ... The CGIs are csh script (also using uncgi). ... The other CGI does as a first pass a check on all the form fields and reports possible errors. ...
    (comp.infosystems.www.authoring.html)
  • Re: Client validation
    ... >form fields are repopulated from the ActionForm. ... a solution based on JavaScript or Flash is not fully ... evolve that into a full blown Applet, that has power assist for data ...
    (comp.lang.java.programmer)
  • Re: [PHP] php to generate java-script
    ... i agree with brian. ... solution is to write generic validation components in javascript. ... // find all form fields for current page ...
    (php.general)