hongjun
asked on
Disable Web Browser Show Document Modified Prompt
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";
}
else
{
webBrowser1.DocumentText = txtEditor.Text;
txtEditor.Visible = false;
webBrowser1.Visible = true;
viewButton.Text = "HTML";
}
}
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";
}
else
{
webBrowser1.DocumentText = txtEditor.Text;
txtEditor.Visible = false;
webBrowser1.Visible = true;
viewButton.Text = "HTML";
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I will try that tonight.
hongjun
hongjun
ASKER
>> webBrowser1.AllowNavigatio n = false;
is sufficient for me.
hongjun
is sufficient for me.
hongjun
ASKER
thanks :)
ASKER
https://filedb.experts-exchange.com/incoming/ee-stuff/4261-screen.JPG
hongjun