knonk knonk

knonk knonk

  • NA
  • 1
  • 0

Is this bug of DocumentText in webbrowser control ?

Jan 4 2010 1:23 PM
Hi, Im using webbrowser control in C# to display content, and I used pasteHTML to change the content of webbrowser control when user clicked on a button, code looks like this :
CODE

public void OnClickButton1(object sender, EventArgs e)
{
           
IHTMLDocument2 htmlDocument = browser1.Document.DomDocument as IHTMLDocument2;
           
IHTMLSelectionObject currentSelection = htmlDocument.selection;
           
if (currentSelection != null)
           
{
                       
IHTMLTxtRange range = currentSelection.createRange() as IHTMLTxtRange;
                        range
.pasteHTML("<b> Text is inserted by pasteHTML method</b>");
                        range
.collapse(true);
                        range
.select();
             
}
}

But when I get text from browser1 control by this code :
CODE

string documentText = browser1.DocumentText;

It dosen't exist string "<b> Text is inserted by pasteHTML method</b>" in documentText variable !
Anyone can explain why for me, please ? and How can I get that document text which is inserted dynamic by pasteHTML(..) method at runtime ?! thanks alot.