469,889 Members | 1,241 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,889 developers. It's quick & easy.

Windows Forms Binding to HTMLElement Events

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").GetElementsByTagNa me("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
Jan 23 '07 #1
1 2325
Bump

"AMDRIT" <am****@hotmail.comwrote in message
news:Og****************@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").GetElementsByTagNa me("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

Jan 26 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Jason Keirstead | last post: by
reply views Thread by Tim Haughton | last post: by
reply views Thread by Empire City | last post: by
3 posts views Thread by Scott | last post: by
14 posts views Thread by RL Stevenson | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.