c# How possible geckowebbrowser tr tableto htmal data show in textbox?

241 Views Asked by At
<tr><td colspan="3" class="sms_content">4173 message      </td></tr>

I am want html data show in our textbox but I am fail so need help.

Below code I am trying.

 GeckoElementCollection tagsCollection = geckoWebBrowser1.Document.GetElementsByTagName("tr");

        foreach (GeckoElement currentTag in tagsCollection)
        {
            if (currentTag.GetAttribute("colspan").Contains("3"))
            {
                ((GeckoHtmlElement)currentTag).GetAttribute(textBox36.Text);


                delay(300);


            }

            else
            {

            }
        }

It's really important for me so if you provide any better solution then it's really great for me & also for all.

1

There are 1 best solutions below

0
On

Looks like in your foreach loop you are iterating through TR elements, not TD. So when you are trying to get attribute, it returns nothing, because TR does not have it. Try this:

var tagsCollection = Browser.Document.GetElementsByTagName("tr");

foreach (var tr in tagsCollection) // iterate through TR
{
    foreach (var td in tr.ChildNodes) // iterate through TD
    {
        if (td.GetAttribute("colspan").Contains("3"))
        {
            var attr = td.GetAttribute(textBox36.Text);

            // some other code
        }
    }
}