Hello Everyone,

We have a production WinForms Application that uses a WebBrowser to display
readonly data. In the html document we have SPAN elements that facilitate
menu selections. We also have a TABLE object that is bound to an XML Data
Island, each row of the table has an option to "View Details" or "Delete"

When a user clicks a SPAN object we would set the WebBrowser's Status Text
to the desired command, then back to "Ready". The windows form would then
capture the statustext change event and process the command. We were
testing the impact IE7 has with this application and found that this
solution no longer works.

We have now decided to listen for the click events of these SPAN objects
from within the windows form. This is working wonderful except for the SPAN
objects in the databound table. Here in lies my question, how do we get the
click events to fire in our windows form?

Below is a snippet of code that we use to add the event handler, first for
the top level menu items, then for the menu items on each row of the table.

For Each objElement As HtmlElement In
objHTML.All.Item("menusection").GetElementsByTagName("SPAN")

'Top level menu Items are seperated with " | ", so ignore them
If Not objElement.InnerText.Contains("|") Then
AddHandler objElement.Click, AddressOf MenuItemClicked
Trace.WriteLine(String.Format("{0}, {1}", objElement.TagName,
objElement.InnerText))
End If

Next

For Each objElement As HtmlElement In
objHTML.All.Item("menutable").GetElementsByTagName("SPAN")

'The only two menu items that we want to listen for are "Delete" and
"View Details"
If objElement.InnerText.Contains("Delete") Or
objElement.InnerText.Contains("View Details") Then
AddHandler objElement.Click, AddressOf MenuItemClicked
Trace.WriteLine(String.Format("{0}, {1}", objElement.TagName,
objElement.InnerText))
End If

Next


Thanks in advance

Re: Windows Forms Binding to HTMLElement Events by AMDRIT

AMDRIT
Fri Jan 26 08:49:08 CST 2007

Bump

"AMDRIT" <amdrit@hotmail.com> wrote in message
news:Ogr%23U1xPHHA.2312@TK2MSFTNGP04.phx.gbl...
> Hello Everyone,
>
> We have a production WinForms Application that uses a WebBrowser to
> display readonly data. In the html document we have SPAN elements that
> facilitate menu selections. We also have a TABLE object that is bound to
> an XML Data Island, each row of the table has an option to "View Details"
> or "Delete"
>
> When a user clicks a SPAN object we would set the WebBrowser's Status Text
> to the desired command, then back to "Ready". The windows form would then
> capture the statustext change event and process the command. We were
> testing the impact IE7 has with this application and found that this
> solution no longer works.
>
> We have now decided to listen for the click events of these SPAN objects
> from within the windows form. This is working wonderful except for the
> SPAN objects in the databound table. Here in lies my question, how do we
> get the click events to fire in our windows form?
>
> Below is a snippet of code that we use to add the event handler, first for
> the top level menu items, then for the menu items on each row of the
> table.
>
> For Each objElement As HtmlElement In
> objHTML.All.Item("menusection").GetElementsByTagName("SPAN")
>
> 'Top level menu Items are seperated with " | ", so ignore them
> If Not objElement.InnerText.Contains("|") Then
> AddHandler objElement.Click, AddressOf MenuItemClicked
> Trace.WriteLine(String.Format("{0}, {1}", objElement.TagName,
> objElement.InnerText))
> End If
>
> Next
>
> For Each objElement As HtmlElement In
> objHTML.All.Item("menutable").GetElementsByTagName("SPAN")
>
> 'The only two menu items that we want to listen for are "Delete"
> and "View Details"
> If objElement.InnerText.Contains("Delete") Or
> objElement.InnerText.Contains("View Details") Then
> AddHandler objElement.Click, AddressOf MenuItemClicked
> Trace.WriteLine(String.Format("{0}, {1}", objElement.TagName,
> objElement.InnerText))
> End If
>
> Next
>
>
> Thanks in advance
>