Connecting Tech Pros Worldwide Forums | Help | Site Map

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

Gary
Guest
 
Posts: n/a
#1: Nov 15 '05
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



Nicholas Paldino [.NET/C# MVP]
Guest
 
Posts: n/a
#2: Nov 15 '05

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


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]
- nicholas.paldino@exisconsulting.com

"Gary" <msnews@microsoft.com> wrote in message
news:O8MLqRcUDHA.2568@tk2msftngp13.phx.gbl...[color=blue]
> Hi,
> I am developing desktop application. In the desktop application am loading[/color]
a[color=blue]
> 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
>
>[/color]


Gary
Guest
 
Posts: n/a
#3: Nov 15 '05

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


Thanks a lot, Nicholas.
- Gary

"Nicholas Paldino [.NET/C# MVP]" <nicholas.paldino@exisconsulting.com> wrote
in message news:OSdSJNeUDHA.2156@TK2MSFTNGP11.phx.gbl...[color=blue]
> 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.[/color]
Once[color=blue]
> 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]
> - nicholas.paldino@exisconsulting.com
>
> "Gary" <msnews@microsoft.com> wrote in message
> news:O8MLqRcUDHA.2568@tk2msftngp13.phx.gbl...[color=green]
> > Hi,
> > I am developing desktop application. In the desktop application am[/color][/color]
loading[color=blue]
> a[color=green]
> > html page, i want to acces html element value from C# code.
> > Can anyone help me? how to access a html element or clientside[/color][/color]
javascript[color=blue][color=green]
> > object from C# code.
> >
> > Note: i am not using web server.
> >
> > TIA,
> >
> > Gary
> >
> >[/color]
>
>[/color]


Closed Thread