Home All Groups Group Topic Archive Search About

accessing document object model (DOM) using vb and asp.net

Author
29 Dec 2005 4:26 PM
Randall Arnold
I've got an asp.net page that dynamically generates an html table on the
server side.  On the client side, I need to copy the rendered table to the
clipboard programmatically (using vbscript).  I just need to be pointed
toward a resource for accessing the DOM this way.  I must be searching on
the wrong keywords because so far I can't find anything helpful, even on
Microsoft's site.

My development environment is Visual Web developer Express 2005.  Thanks,

Randall Arnold

Author
29 Dec 2005 5:20 PM
Cor Ligthert [MVP]
Randall,

Have a look at Google how to use the clipboard with JavaScript on the
clientside.

http://www.google.com/search?hl=en&q=javascript+clipboard+&btnG=Google+Search

The first one gives you already a fine solution.

You can integrate this in your VB code, however in this case it will in my
opinion give you not much benefits.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuipageclassregisterclientscriptblocktopic.asp

I hope this helps,

Cor
Author
29 Dec 2005 6:04 PM
Randall Arnold
Thanks Cor.

I hadn't googled those terms because that wasn't my first choice of
methods... but based on what little I've turned up so far it may be all I
can do.  I'm much more familiar with vb than javascript and try to stay with
what I'm familiar with... especially since, given the fact I'm encountering
difficulty doing something I thought would be simple in VB, it's likely to
frustrate me 10 times as much in another language I rarely use.

All I want to do is programmatically copy a specific html table from an
asp.net page to a Powerpoint slide.  If I'd known it was going to become
such a freaking nightmare I'd have never mentioned ASP.NET as a solution to
my boss.  The platform is not ready for prime time IMO, and that's really
sad.

I should have stuck with Windows forms...

Randall

Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:um12jwJDGHA.2036@TK2MSFTNGP14.phx.gbl...
> Randall,
>
> Have a look at Google how to use the clipboard with JavaScript on the
> clientside.
>
> http://www.google.com/search?hl=en&q=javascript+clipboard+&btnG=Google+Search
>
> The first one gives you already a fine solution.
>
> You can integrate this in your VB code, however in this case it will in my
> opinion give you not much benefits.
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuipageclassregisterclientscriptblocktopic.asp
>
> I hope this helps,
>
> Cor
>
>
>
Author
29 Dec 2005 6:31 PM
Chris Dunaway
You can use the same method with VBScript.  Instead of JavaScript, code
VBScript.
Author
29 Dec 2005 6:46 PM
Cor Ligthert [MVP]
Chis,

See the comment from Ken about that which I of course completely deal.

:-)

Cor
Author
29 Dec 2005 8:38 PM
Randall Arnold
This is an intranet solution so the point about vbscript compatibility is
actually moot-- the company uses IE almost exclusively.

But the issue itself is practically moot, anyway.  I'm more frustrated now
than ever even after the recent suggestions.  I just can't see how this can
be done, and IMO it should be extremely simple.

20 years of programming, using a variety of languages, on multiple
platforms, and I've NEVER encountered this much trouble getting something so
basic to work.  Copying an object from a web page to an open document should
NOT be impossible or even moderately difficult.

I am about to join the other developers who have sworn off ASP.NET for
PHP... this is for the birds.  : (

Randall Arnold

Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:O7fJrgKDGHA.3820@TK2MSFTNGP12.phx.gbl...
> Chis,
>
> See the comment from Ken about that which I of course completely deal.
>
> :-)
>
> Cor
>
Author
30 Dec 2005 7:56 AM
Cor Ligthert [MVP]
Randall,

Web applications *where* great to work with.

Security has however removed this *great* to a situation where almost
everything that you think that you would do is not possible anymore. The
Rich Client can in your situation as you now describe it a way to go.

http://msdn.microsoft.com/msdnmag/issues/02/06/rich/default.aspx

This is however not for the open web as are ActiveX compenents impossible to
use because allmost non users will allow to use them if they are not
completely sure that it is from you and they know you.

I hope this gives some ideas.

Cor
Author
2 Jan 2006 6:12 AM
Randall Arnold
Thanks Cor, I'll look into this.

What irks me is there does not seem to be a trusted intranet model that
would allow me to disregard security hindrances that don't apply.  In other
words, if I want to enable 100% clipboard access in intranet-only
situations, I believe I should have that ability.  I don't like MS (or any
other company) forcing a "one size fits all" security model on us as
developers.

Randall Arnold

Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:%23BgqtZRDGHA.688@TK2MSFTNGP11.phx.gbl...
> Randall,
>
> Web applications *where* great to work with.
>
> Security has however removed this *great* to a situation where almost
> everything that you think that you would do is not possible anymore. The
> Rich Client can in your situation as you now describe it a way to go.
>
> http://msdn.microsoft.com/msdnmag/issues/02/06/rich/default.aspx
>
> This is however not for the open web as are ActiveX compenents impossible
> to use because allmost non users will allow to use them if they are not
> completely sure that it is from you and they know you.
>
> I hope this gives some ideas.
>
> Cor
>
>
Author
7 Jan 2006 9:23 AM
Rahul Parundekar
Hi.
I am a student from VIT college Pune, India
i am developing a project for a competition which has to read a table
generated by an asp page and store it to a local database using vb6.
it seems to be similar to what you are doing.
i tried inet,webbrowser,url methods  etc, but the page saved has no
table in its source... only a </table> tag
i was wondering if you found  a way to grab a table from an asp
page.....
please reply to me at rparunde***@hotmail.com
the project basically aims at interfacing a mobile phone to the pc...
and using the data in the table to send via sms on query....
Author
7 Jan 2006 10:09 AM
Cor Ligthert [MVP]
Rahul,

Ask your questions next time not in the midlle of a messagethread, you
probably will not get any answer. This is an incident because I was active
in this thread and check it than.

http://www.vb-tips.com/default.aspx?ID=541adf13-d9c0-435c-893f-56dbb63fdf1c

I hope this helps,

Cor
Author
9 Jan 2006 4:22 AM
Rahul Parundekar
thanks cor
sorry.... and i will try the code and let you kno
Author
17 Jan 2006 7:55 AM
Anders Franzen
I'll use javascript for this in one of my webapps.

Here's the code:

<script language="JavaScript" type="text/JavaScript">
function ctcb(src) {
    eval(src +".style.display='block'");
    document.selection.clear;
    txt = eval(src +".innerText");
    theObj = document.all(txt);
    txtRange = document.body.createTextRange();
    txtRange.moveToElementText(eval(src));
    txtRange.select();
    txtRange.execCommand("Copy");
    eval(src +".style.display='none'");
    alert('Data copied to clipboard!');
}
</script>

'Put the table between PRE tags
<pre id="toClipBoard" style="display:none">
<table>
<tr>
<td>Testing</td>
<td>Clipboard</td>
</tr>
</table>
</pre>

'Execute the copy
<a href="javascript:ctcb('toClipBoard')">Click to Copy</a>

You don't have to hide/show the table, i'll do this because it has a
different layout.


*** Sent via Developersdex http://www.developersdex.com ***
Author
7 Jan 2006 4:49 PM
Alex Ataev
Hi Randal and Rahul!

I have a very similar situation. I need to read data programmatically
(VBA) from web page into MS Access application. I'm also using a web
browser control on Access form. Control does show a web page, supports
navigation, but how to read data programmatically from there?
Did you find finally any solution for this problem?

If so, please let me know.
Thank you!



*** Sent via Developersdex http://www.developersdex.com ***