473,654 Members | 2,968 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing html element or client side javascript object from C#.

Hi,
I am developing desktop application. In the desktop application am loading a
html page, i want to acces html element value from C# code.
Can anyone help me? how to access a html element or clientside javascript
object from C# code.

Note: i am not using web server.

TIA,

Gary
Nov 15 '05 #1
2 11286
Gary,

If you are hosting the web browser control that is showing the HTML,
then the control exposes a document property that you can use to get the
IHTMLDocument2 interface that represents the DOM of the HTML document. Once
you have this, you can access the document in any way that you wish.

You might want to add a reference to MSHTML.TLB in order to get the
types that you can access in the DOM.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni************* *@exisconsultin g.com

"Gary" <ms****@microso ft.com> wrote in message
news:O8******** ******@tk2msftn gp13.phx.gbl...
Hi,
I am developing desktop application. In the desktop application am loading a html page, i want to acces html element value from C# code.
Can anyone help me? how to access a html element or clientside javascript
object from C# code.

Note: i am not using web server.

TIA,

Gary

Nov 15 '05 #2
Thanks a lot, Nicholas.
- Gary

"Nicholas Paldino [.NET/C# MVP]" <ni************ **@exisconsulti ng.com> wrote
in message news:OS******** ******@TK2MSFTN GP11.phx.gbl...
Gary,

If you are hosting the web browser control that is showing the HTML,
then the control exposes a document property that you can use to get the
IHTMLDocument2 interface that represents the DOM of the HTML document. Once you have this, you can access the document in any way that you wish.

You might want to add a reference to MSHTML.TLB in order to get the
types that you can access in the DOM.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni************* *@exisconsultin g.com

"Gary" <ms****@microso ft.com> wrote in message
news:O8******** ******@tk2msftn gp13.phx.gbl...
Hi,
I am developing desktop application. In the desktop application am loading
a
html page, i want to acces html element value from C# code.
Can anyone help me? how to access a html element or clientside

javascript object from C# code.

Note: i am not using web server.

TIA,

Gary


Nov 15 '05 #3

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

Similar topics

8
22738
by: Frank Ratzlow | last post by:
Hi folks, I have a list of entries where some entries contain the special character (quotes) within in the string. If I try to save this entry everything after the quotes is skipped. The reason for this is quite obvious, since the resulting html tag looks like this: <option value="go "again" selected="selected">nochmal &quot;go</option>
5
3599
by: KathyB | last post by:
If someone could just explain this to me...I just don't get it! I have an aspx page where I retrieve several session variables and use xmlDocument to transform xml file with xsl file into an instruction document (not data based) - same as using an xml web control. The resulting html is on the client? but what about the server side of things? Trying to figure out how to change and save the xmlDocument. It I put a button OUTSIDE of the...
2
8387
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when submitting the form to update the database. The server doesn't have the client side value any more. It seems to me that as I begin to write the client side javacript code for form validation and client side editing capabilities in order to save...
1
2132
by: Salek Talangi | last post by:
Hello, I have following (probably very basic) problem: I made a html-frameset in VS.net, where the frames itself are aspx-pages with webforms. Now I want to access the webforms (eg. give a label a text) from one .aspx.vb page. I managed to get all the code into one file by writing the same file in the codebehind statement of all aspx files. Now I have one big .aspx.vb file with:
1
3118
by: CS Wong | last post by:
Hi, I have a page form where form elements are created dynamically using Javascript instead of programatically at the code-behind level. I have problems accessing the dynamically-created elements and would like to seek a solution for this. I had looked through several articles for accessing programatically-created dynamic elements such as: 1)
0
12071
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 likelihood of CRM success from less than 20 percent to 60 percent. WHITEPAPER :
9
2145
by: Phil_Harvey | last post by:
I am redoing my website and trying to get it to do something more exciting using Javascript. I did normal Java at university and code at work in VB.NET. I have got reasonably far into what I want to do but am having some issues. Firstly I am using an XmlHttpRequest to pull html fragments out of files and wish to put them into the main doccument inplace of a <span></span> which has a given id. The user enters a "command" into a TextField...
3
2070
by: rolf.oltmans | last post by:
Hello, I've been trying to access the html element "Body" in my server side code. I've searched the archives of this group and have been able to put together an example that doesn't work :) Actually, I am want to raise an event at client side and want to perform some action on the server side when that event at client is triggered. So here is what I am trying to do, <%@ Page Language="C#" AutoEventWireup="true"...
5
1667
by: thisis | last post by:
Hi All, Hi All, (this is not the same topic as the my previous topic) What objects/methods/properties does VBScript offer for: Assuring/guarantee/make certain that ASP/VBSCript an ELEMENT - e.g. <img ... / - was FULLY Loaded into web Browser
0
8285
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8814
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8706
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8475
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8591
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7304
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4293
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2709
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.