Disable Web Browser Show Document Modified Prompt
Posted on 2007-08-05
I have created an HTML editor. In my application, I have a toolbar to toggle visiblity of a webbrowser control and a multiline textbox control to show HTML page and HTML source respectively.
All is working fine except let's say I input "Hello World" as input in HTML mode, then click the toggle button to switch to Text Mode, I will see the HTML source correctly. However, when I tried to toggle back to HTML mode, I will get a prompt telling me "document has been modified". How do I disable this prompt from appearing?
I shall attach the screen for the "dialog" in a short while.
Below is my code fragment.
private void viewButton_Click(object sender, EventArgs e)
if (viewButton.Text == "HTML")
txtEditor.Text = webBrowser1.DocumentText;
txtEditor.Visible = true;
webBrowser1.Visible = false;
viewButton.Text = "TEXT";
webBrowser1.DocumentText = txtEditor.Text;
txtEditor.Visible = false;
webBrowser1.Visible = true;
viewButton.Text = "HTML";