How to turn off javascript in a WPF Frame element. It pops up with a:
"Script Error. An error has occurred in the script on this page"
frame1.Source = new System.Uri("http://www.stuff.co.nz");
If your version of .NET for this application supports it, have you tried using the WebBrowser control?
http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser.aspx
Update: I found a blog post that has a fix for this, although it doesn't do exactly what you wanted. It uses javascript script injection to disable javascript errors. I have not tested this.
http://www.codewrecks.com/blog/index.php/2010/08/31/disable-javascript-error-in-wpf-webbrowser-control/
Related
I have a website that uses bootstrap and I am accessing the website through a wpf form using the web browser control.
When I navigate to certain pages I get a script error window that says Invalid operand to instanceof: Function expected
The WPF form is my way of recreating a client's application where this same issue is occurring.
I can only change the html of the site , has anyone experienced this and found a solution ?
Is there a way to turn on debugging so i step thru and find what is calling the code
Has anyone specifically experienced something like this with the wpf browser control, and how did you get past it?
I figured it out: I stumbled across an entry on Rick Strahl's weblog (https://weblog.west-wind.com/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version) about the web browser control, and in one of the comments, a commenter said that he tried adding the following meta tag to the page:
<meta http-equiv="X-UA-Compatible" content="IE=11" />
So I put that in the master page of my application, and everything worked!
I have an asp.net application which uses the web part framework to allow users to customise their interface. One of the features of this is a catalog of available web parts, one is provided by default, but it can be overriden if you wish to change the layout, etc.
override void RenderCatalogPart(HtmlTextWriter writer, CatalogPart catalogPart)
That, as far as I can tell, is the only way to do it. At the moment I'm creating a panel with all the necessary elements in it, and using the panel's RenderControl method to output it to the htmlwriter. So far, so good. The problem occurs when I try to add a radtooltip to my panel, using the same RenderControl method, and I get the following runtime error:
Page cannot be null. Please ensure that this operation is being performed in the context of an ASP.NET request.
I can see why this might be a problem, since the tooltip presumably uses javascript and has to write it to the page - but the RenderCatalogPart method has no knowledge of which page it's going to be outputting to. Is there any way around this or am I going to have to come up with an alternative?
I've posted this on the telerik website but though I'd ask here as well incase anyone has any ideas.
Thanks.
The Telerik ASP.NET controls require a MS AJAX ScriptManager control. I suppose that's why they want to access the page as well - to get a reference to the ScriptManager. Try setting the tooltip's RegisterWithScriptManager property to false and see if the control renders then.
The issue here is that the ToolTips must be created and added as controls in PreRender, so that it can add it's script to the ScriptManager.
Creating a collection of tooltips in the PreRender() method and then writing them to the httpwriter as shown above in RenderCatalogPart fixes the problem.
i am trying to the MaskedEditExtender and MaskedEditValidator to work.
im not getting any type of error; however the maskededitextender or validator are completely not working.
the question is exactly similar to:
ajaxtoolkit maskededitextender not working
ive downloaded a sample of the maskededitor from the asp.net site and running the code exactly as is.
what am i doing wrong?
if you think jquery is better for this please do send me an example!
I must say that it's been long time that I have used the Ajax Toolkit as I started to use more and more jQuery and understand Javascript better, I realized that Ajax Toolkit was creating to much code for really simple things.
My suggestion goes to use a jQuery Plugin as you probably are already using jQuery for something else.
start with this really simple tutorial:
http://webdeveloperplus.com/jquery/how-to-mask-input-with-jquery/
The web site was built on asp.net platform. Ajax enabled. It works very well on
ie or chrome, but it does not work on mozilla...?
You see arrows work great but the numbers does not appear?
how can i fix..
http://dexiab-2.hosting.parking.ru//Default.aspx#world the link to see the detail..
I think that the problem is the label tag that you use, change the label to span (or div), and probably its going to work.
I have a class of library code which uses a System.Windows.Forms.WebBrowser control to load a web page then extract information from the DOM tree, etc... I've found this to be the only reliable way to be able to parse information loaded onto a page with javascript, etc...
This worked fine when testing with console app, but when I call the same method from an asp.net page (ASP.NET MVC Controller) it crashes with a "ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment."... i've tried adding [STAThread] to my method but that doesn't seem to help!
Any ideas?
Thanks
Update:
I need to allow a page to complete load and execute all its javascript, then search it for text that matches a template I have already stored... Don't think HtmlAgilityPack will work? Does WatIn run the javascript?
Save yourself a lot of headache and use WatiN instead of a WebBrowser control.
See this question: Best method for Website Automation?
I believe it is impossible to get IIS to run in single thread apartment model (STA). Instead of using the WebBrowser control, you could take a look at the HTML Agility Pack. It will let your read in a web page and poke around the DOM. The WebBrowser control uses lots of computer resources that you won't have to worry about it make the switch.
Everything in the System.Windows is intended for desktop, not web stuff. I agree with Jake Pearson that you should use something else. But if you want you can try forcing the page into STA mode using this directive:
<%#Page AspCompat="true"%>
http://msdn.microsoft.com/en-us/library/zwk9h2kb.aspx