How to RemoveChild from HtmlElement from C#

  • Thread starter Thread starter Vin
  • Start date Start date
V

Vin

Hi,

I have a webbrowser control in my winform. There is an html in the
webbrowser which has a table, and many child <tr>s and <td>s inside it.
I want to delete a specific <tr> node completely from the html. (I dont
want to do style = "display:none"). I want to do RemoveChild("id of the
tr") of the table, on some button click.

There is no RemoveChild available on HtmlElement.
MS experts, MVPs....any clues on how to do this?

Cheers,
Vin
 
HTML or XHTML?

If you are using non-XML compliant HTML (not XHTML), there are a couple of
options, depending on whether or not you can load the table into an HtmlTable
object. If so, you can pull rows, find the offending row and pluck it. In
most instances, it is easier to rebuild the table and paste it in than it is
to pull off rows. Another option is getting inner text (or HTML) and
replacing the text string with one that has the offending row removed. Regex
can work wonders here.

With XHTML (XML compliant HTML), you can use a XML doc, find nodes with
XPath and prune them using XML standard features. This is a much more elegant
option, but requires XML compliant HTML to work.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
Back
Top