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

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

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
Dec 29 '05 #1
20 3468
Hi,

I would stay away from vbscript because it is only supported in the
internet explorer. Here is a link that shows how to do it with jscript.
http://msdn.microsoft.com/library/de...classtopic.asp

Ken
-----------------------------

"Randall Arnold" wrote:
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

Dec 29 '05 #2
Thanks for the advice, Ken, and I'll give that a shot.

Personally, I'd prefer to do this using VB.NET on the server side but cannot
for the life of me figure it out or find any resources that will help. Is
it even possible to, say, select an html table after the page has rendered
and copy it to the clipboard this way? Seems to me it should be...

Randall

"Ken Tucker [MVP]" <Ke**********@discussions.microsoft.com> wrote in message
news:14**********************************@microsof t.com...
Hi,

I would stay away from vbscript because it is only supported in the
internet explorer. Here is a link that shows how to do it with jscript.
http://msdn.microsoft.com/library/de...classtopic.asp

Ken
-----------------------------

"Randall Arnold" wrote:
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

Dec 29 '05 #3
Randall,

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

http://www.google.com/search?hl=en&q...=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/de...blocktopic.asp

I hope this helps,

Cor

Dec 29 '05 #4
Guess I should have viewed the link before I replied.

I've already tried the method mentioned there with no success. So far,
using that technique combined with other methods, the best I've been able to
do is grab the table's html code, save it to a file, open it in Word, copy
the table to the clipboard from there, and then paste it into Powerpoint
(the intended destination). This is crude and prone to error-- Powerpoint
crashes if I attempt to paste the table (I'm assuming based on
troubleshooting that there is a timing problem, ie, events still processing
when I try the paste method). So the only way to get it to "work" is a
two-fold operation, where one button click creates the html and performs the
copy to clipboard and the second button click creates a Powerpoint instance
and copies the clipboard contents to a slide. I can't figure out how to
check the state of events to make this a one-click operation-- but then, I
don't like this insane workaround anyway.

If I use the example cited with no further massaging, all I end up with is
raw html pasted into Powerpoint instead of a table object.

This is extremely frustrating. What I thought would be a ridiculously easy
endeavor has turned into a MAJOR showstopper for migrating my department's
VB6 app to ASP.NET/VB.NET. One simple table copy/paste snafu is preventing
deployment of a significant improvement to the way we conduct business. I'm
flabbergasted to put it mildly. Previous requests for help in other forums
have gone unanswered, so I guess I've (sigh) once again stumped Microsoft...

Randall

"Ken Tucker [MVP]" <Ke**********@discussions.microsoft.com> wrote in message
news:14**********************************@microsof t.com...
Hi,

I would stay away from vbscript because it is only supported in the
internet explorer. Here is a link that shows how to do it with jscript.
http://msdn.microsoft.com/library/de...classtopic.asp

Ken
-----------------------------

"Randall Arnold" wrote:
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

Dec 29 '05 #5
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

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:um**************@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...=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/de...blocktopic.asp

I hope this helps,

Cor

Dec 29 '05 #6
You can use the same method with VBScript. Instead of JavaScript, code
VBScript.

Dec 29 '05 #7
Thanks, but I can't even see how to select the Table programmatically so
that it can be copied to the clipboard. So far not one method other than
the crude one I'm currently using has worked.

Randall

"Chris Dunaway" <du******@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
You can use the same method with VBScript. Instead of JavaScript, code
VBScript.

Dec 29 '05 #8
Chis,

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

:-)

Cor
Dec 29 '05 #9
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

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:O7**************@TK2MSFTNGP12.phx.gbl...
Chis,

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

:-)

Cor

Dec 29 '05 #10
I think the angle you may have to work from is to use PowerPoint
interop to import a slide from an .html file. You can use the
WebRequest class to get the .html by accessing the .asp then insert a
slide into PowerPoint from the resulting .html.

I am not familiar with PowerPoint interop to know how to do that,
however.

Dec 29 '05 #11
The Powerpoint end of things is no problem for me-- it's the OTHER parts of
your suggestion that get me lost. I wouldn't even know where to start
figuring out how to get the html from an asp page-- in fact, I posed that
question on another forum and the responses so far are wayyyy over my head
(and pertain to C# anyway).

This is depressing.

Randall

"Chris Dunaway" <du******@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I think the angle you may have to work from is to use PowerPoint
interop to import a slide from an .html file. You can use the
WebRequest class to get the .html by accessing the .asp then insert a
slide into PowerPoint from the resulting .html.

I am not familiar with PowerPoint interop to know how to do that,
however.

Dec 29 '05 #12
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/is...h/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
Dec 30 '05 #13
well i do not believe it is possible to copy this info direct from the
webbrowser to a local systems clipboard ( would be new to me )

however it should be verry easy to do this with your own webclient ,,,,
i.ow. a program that you write to access this generated report
this could even be a webbrowser control on a vb form through the vb form you
can now access both the HTML DOM in the webrbrowser control and the
clipboard

another way would be to use a webclient strip the required data from the
page and copy this to the clipboard

regards

regards

Michel Posseth [MCP]

"Randall Arnold" <ra************@nokia.com> schreef in bericht
news:eO*************@TK2MSFTNGP15.phx.gbl...
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

Dec 30 '05 #14
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

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2***************@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/is...h/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

Jan 2 '06 #15
Randall,

I would in your case in one of the security newsgroups.

There seems to be a lot of possibilities for that in an Intranet situation,
however I never tried them. The keyword is AFAIK personalize.

I hope this helps,

Cor
Jan 2 '06 #16
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 rp*********@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....

Jan 7 '06 #17
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?...f-56dbb63fdf1c

I hope this helps,

Cor
Jan 7 '06 #18

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 ***
Jan 7 '06 #19
thanks cor
sorry.... and i will try the code and let you kno

Jan 9 '06 #20
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 ***
Jan 17 '06 #21

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

Similar topics

3
by: Tom Meuzelaar | last post by:
Hello: I'm using VB6 in VS enterprise. I'd like to place an HTML form inside a VB container, have a user fill out the form information, click a submit button, and then have the program capture...
2
by: Chris New | last post by:
G'Day All I am having trouble dynamically assigning a value to a table's cell from one frame to another frame. I've created a website that is primarily viewed in a frameset consisting of 2...
13
by: Stumped and Confused | last post by:
Hello, I really, really, need some help here - I've spent hours trying to find a solution. In a nutshell, I'm trying to have a user input a value in form's textfield. The value should then be...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
20
by: weston | last post by:
I've got a piece of code where, for all the world, it looks like this fails in IE 6: hometab = document.getElementById('hometab'); but this succeeds: hometabemt =...
0
by: sonu | last post by:
I have following client side code which i have used in my asp.net project SummaryFeatured Resources from the IBM Business Values Solution Center WHITEPAPER : CRM Done Right Improve the...
9
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - What is the document object model? ----------------------------------------------------------------------- ...
10
by: Simon Brooke | last post by:
The DOM API has included public Node importNode(Node,boolean) as a method of the Document interface for a long time. Does anything actually implement it? Xerces 2 is giving me: ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.