Windows Forms Binding to HTMLElement Events

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • AMDRIT

    #1

    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.Ite m("menusection" ).GetElementsBy TagName("SPAN")

    'Top level menu Items are seperated with " | ", so ignore them
    If Not objElement.Inne rText.Contains( "|") Then
    AddHandler objElement.Clic k, AddressOf MenuItemClicked
    Trace.WriteLine (String.Format( "{0}, {1}", objElement.TagN ame,
    objElement.Inne rText))
    End If

    Next

    For Each objElement As HtmlElement In
    objHTML.All.Ite m("menutable"). GetElementsByTa gName("SPAN")

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

    Next


    Thanks in advance


  • AMDRIT

    #2
    Re: Windows Forms Binding to HTMLElement Events

    Bump

    "AMDRIT" <amdrit@hotmail .comwrote in message
    news:Ogr%23U1xP HHA.2312@TK2MSF TNGP04.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.Ite m("menusection" ).GetElementsBy TagName("SPAN")
    >
    'Top level menu Items are seperated with " | ", so ignore them
    If Not objElement.Inne rText.Contains( "|") Then
    AddHandler objElement.Clic k, AddressOf MenuItemClicked
    Trace.WriteLine (String.Format( "{0}, {1}", objElement.TagN ame,
    objElement.Inne rText))
    End If
    >
    Next
    >
    For Each objElement As HtmlElement In
    objHTML.All.Ite m("menutable"). GetElementsByTa gName("SPAN")
    >
    'The only two menu items that we want to listen for are "Delete"
    and "View Details"
    If objElement.Inne rText.Contains( "Delete") Or
    objElement.Inne rText.Contains( "View Details") Then
    AddHandler objElement.Clic k, AddressOf MenuItemClicked
    Trace.WriteLine (String.Format( "{0}, {1}", objElement.TagN ame,
    objElement.Inne rText))
    End If
    >
    Next
    >
    >
    Thanks in advance
    >

    Comment

    Working...