Note that there are some explanatory texts on larger screens.

plurals
  1. POEditing inner HTML of an element not working
    primarykey
    data
    text
    <p>My goal is to add some specific HTML inside a table body.</p> <p>Code notes:</p> <ul> <li>tbody points to the body</li> <li>"Hello \n" is very simple word for example I want to add </li> <li>I've the HTML stored in another variable</li> </ul> <p>Now each time I get exception &amp; it doesn't accept my Edit</p> <pre><code>var tbody = table.GetElementsByTagName("tbody")[0]; //tbody.InnerHtml = " &lt;/br&gt; "; foreach (DataGridViewRow row in dataGridView1.Rows) { try { tbody.InnerHtml = tbody.InnerHtml + "Hello \n"; } catch (Exception) { } } </code></pre> <p><strong>Update:</strong></p> <p>I also tried another method but the result was:</p> <p><img src="https://i.stack.imgur.com/37HKG.png" alt="enter image description here"></p> <p><strong>Update 2:</strong></p> <p>This is a desktop application , I want to change in the innerHtml value for a table that I obtained from WebBrowser Control</p> <p><strong>Update 3:</strong></p> <p><em>Exception</em></p> <p>System.NotSupportedException was caught Message=Property is not supported on this type of HtmlElement. Source=System.Windows.Forms StackTrace: at System.Windows.Forms.HtmlElement.set_InnerHtml(String value) at WebScrapper.Form1.webBrowser2_DocumentCompleted(Object sender, WebBrowserDocumentCompletedEventArgs e) in E:\Companies-work\FreeLancer\WebScrapper\WebScrapper\WebScrapper\Form1.cs:line 248 InnerException: </p> <p><strong>Update 4:</strong></p> <p><em>Checking if tbody is null or not</em> <img src="https://i.stack.imgur.com/S1H4w.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload