Embedded XBAP in IFrame always on top - c#

It is possible to embed an XBAP application into an IFrame, this is rather easy !!
The problem however is that it renders on top of anything within the web application. For example!
I have a menu in my web application which can collapse when I hover above it, but it will collapse UNDER the IFrame when it needs to collapse ON TOP of the IFrame with the XBAP Application in it.
I tried messing with the z-index but this does not fix anything!
It seems it has nothing to do with the IFrame, because when I put plain HTML into the IFrame it renders on top of the IFrame.
My last effort would be to put the XBAP Application in new browser window !! But it would be so much nicer to have it embedded within the application.
This guy seems to have the same problem

This is a known issue with controls/plugins that aren't rendered by the browser itself (these controls have their own windows, which are merely positioned inside the browser instead of composed within it). If you're willing to use Silverlight instead, there is a partial solution available with windowless controls that will allow you to intermix DOM content and managed code, but they have their own limitations. The upcoming Silverlight 4 can do even more than XBAPs as far as local trust/resource access...

Related

Telerik chart not loading correctly (ajax/script issue?)

I have a page which contains user controls with Telerik Charts (grids also, but they work fine). From this page, the user can click on a button to be redirected to a "Printer-Friendly Version" type page, which opens a new window via javascript and goes through a slightly different view (for formatting and stuff), but the telerik code is all the same.
The problem is, my Chart displays just fine in the original window, but the new window displays basically an empty chart with no data. This bug is only present in IE, and only applies to Charts. Grids work fine, for whatever reason. I'm thinking this is due to differences in script caching between browsers -- correct me if I'm wrong, I'm semi-new to client-directed web development.
Anyway I read somewhere that Telerik has issues with loading data and/or js files when loaded via ajax, so maybe that's the problem? If so, how could I get around this? And if not, any ideas on what could be causing this issue? It's causing me a great deal of frustration, since a print preview page seems like it should be the easiest of jobs.
Edit:
The charts are being rendered as html (if somebody can explain how to render them as images, that would be awesome). And dev tools shows basically the same thing between chrome and IE. Whenever my web service goes back up ill WinMerge them and look for any peculiarities/differences between them. In the mean time, though, the "render as an image" concept sounds promising. That way I could just save the image from the first page, and insert it right into the print preview page, right?. And since it's a print-preview page, it's not going to need to be interactive or anything, so that'd work out nicely.
Another (important) Edit:
These are probably the culprit...
And here is a little more detail on that:
And here is a side-by-side of it working(in chrome) and not working (in IE):
Have you considered using a print-specific stylesheet instead, e.g.
<link rel="stylesheet" type="text/css" media="print" href="print.css" />
In which you specify the styling to apply when printing.
That way, you avoid reloading the page (duplicate database hits, etc.) and don't need to delve into the AJAX of Telerik's controls.
EDIT:
Regarding using an image rather than HTML, first make sure you won't lose any features/detail, then check out the .Save() method of the RadChart control. You could either save it to a memory stream, or if you want to re-use the image save it to a directory on the webserver and clean it up periodically. That way, you can just point your print version to the image and not re-generate it.
This Telerik forum post may be of use.

Webbrowser and IE acts differently?

I'm in a trouble trying to fix some problem.. I have a program with Webbrowser control inside it.
It automates crawling process from some website. The problem is that I cannot fix webbrowser after recent website changes.
They have changed page navigation on website. And when I do actions MANUALLY in webbrowser (in my app) it doesn't go to the next/previous page on website. It does nothing... Whereas it works properly in IE 7/8/9 (only scripting errors thrown this time).
So does it mean that Webbrowser is not fully similar to IE??
I'm sorry for not showing source codes here, I think it wouldn't help here. Which way should I go to troubleshoot it? Why page navigation is not working in Webbrowser control?
I tried to simply put Webbrowser on a Window Form in new project and tried to navigate page 2/3/../10 in the website catalog, but it simply changes page number and doesn't navigate to it...
EDIT: Website doesn't work propely even if I do actions manually in webbrowser using mouse clicks.. but works in IE.
EDIT2: I might be not clear in my question. The problem is that I cannot use website even Manually with mouseclicks via my Webbrowser control in app. It changes page number after I click on it, but it doesn't navigate to that page. It stays silent. I'm sure that AllowNavigation property is true. It worked just yesterday and stopped after website changes today... Please tell me which way should I go to troubleshoot it.. I thought that Webbrowser control acts the same way as Internet Explorer.. Any help from you highly appreciated! Thanks
EDIT3: Strange thing... i just loaded Extended Webbrowser and navigated to that website. Page navigation panel doesn't work there also.. Is it a bug on their side or some type of guard from crawlers? What do you think?
(http://www.codeproject.com/KB/cpp/ExtendedWebBrowser.aspx)
I'm sure this isn't the answer your want but using the webbrowser control to scrape websites is very painful to maintain.
Instead use the HttpWebRequest and HttpWebRepsonse objects to recreate the calls to the webserver.
You can use Fiddler (http://www.fiddler2.com/fiddler2) and your browser to record your web sessions and recreate them in code.
You can setup your webbrowser control to disable a number of features including navigation.
I.e. to disable nav in the C# WebBrowser control:
webBrowser1.AllowNavigation = false;
I'd double check that you're not doing anything like this.
I had the same issue with a certain web site that recently changed its format. It has to do with the version of IE used by the control.
Simply force the IE version used to the latest (in my case 9). Setting the appropriate registry item to 9999 for my application worked; see: Webbrowser control behaving different than IE

ASP.NET Menu control changing position after postback

I am currently testing a menu in ASP.NET I've recently made using asp:menu control.
The menu is just as I want it to be right now, but whenever there is a postback that updates the whole page, it moves a little downwards (only once, a second postback won't move it a little bit more).
It's not CSS - > I've removed all CSS from this menu)
It's not any property -> I've commented out everything related to customizing the menu
It's not any other element above it enlarging -> I've specially put it inside a table, in which the only content is the asp:menu control
It moves a lot downwards in IE6, a little in IE8, and it doesn't move at all in Firefox 4.
What could I do ? Are there any alternatives ? Is there any property I can use, or any outer element I could put it inside in order for it to stay still ?
And yes, every single machine this is going to run in is using Internet Explorer. The nightmare of any web developer.
---[update]-----
I've built a menu in a separate project, and the effect wasn't there! I've copied the exact same files into my project, and ran it, and the issue was there.
Could it be a difference in the asp.net version ?
Did you check using IE web developer toolbar to see what's the html looks like in that area before and after the postback? It seems more like a browser issue so the toolbar would give you details as what is coming in the gap or may be what's pushing it down.
If the app is in asp.net 4.0, look at the source code of the page after it renders the first time, and then after the postback. Make sure it renders as divs on both or tables on both.
I currently have a similar issue where my menu "spreads out" on the postback. Before the postback, it renders divs. After the postback, it renders tables.
There is specifically a property on the menu "RenderingMode" which is suppose to control this, but it is not working for me.
I had the same problem. My navigation menu sits in an UpdatePanel, and I changed the UpdateMode from Always to Conditional - problem solved. This was in my master page.

How to add IFRAME in SilverLight?

How do I add IFrame in a Silverlight 4.0 User control ?
And I want a button on the control that refreshes the IFrame. Is that possible?
To render HTML on top of silverlight, you have to use WindowLess mode. This is a configuration in the object tag. Then you'll need to manually program your IFrame to float in the correct location using javascript or the bridge provided by Silverlight. You can use a commercial control like Robaticus suggested or figure it out on your own.
Either way, none of these options work for Mac. So if you're developing for Windows only, then you're ok. Anyone using Mac will not see any HTML float on top of Silverlight.
If you absolutely want an IFrame in the HTML page (contrary to what the other answers suggest) you could obtain access to the IFrame in Silverlight by using the HTML Bridge
I think you can use WebBrowser class to display IFrame content in Silverlight. Or check this link it will also help you. - How to use iFrame tag in XAML Silverlight 4?
The iframe tag is HTML, not Silverlight. If you have an out-of-browser Silverlight application, you could potentially use the WebBrowser control, but this is not available for in-browser applications.
There is an approach out there where you can essentially make a DIV on your hosting page appear overtop of your Silverlight application, but, in my experience, this is very hard to control, and the visual results are less-than-ideal.
Additionally, there are a few commercial components that do HTML rendering, but they all seem to use the same approach of a floating DIV, and they are not as reliable as I would like to see them.

C# WinForms: Should I use a web browser control

I am building a windows forms application that I will be adding a control within that will display quite a bit of different data. For the most part the data inside will be navigation buttons and help/training text.
I think it would be ideal if I could write the contents in HTML and then just display that in the control in the application, but I am not sure if this is a good idea.
Another point to note is there will be a web based version of the same application at some point in the near future, and doing this part of the application in HTML will make for very easy reusability.
The users will not have IIS installed, if this matters.
For this purpose, I think that an embedded web browser would be absolutely great. Alot of applications use a web browser control for navigation, information, training, etc. Steam is one example. In addition, reusability is almost always a best practice.
But I would use WebKit instead of the built-in IE web browser control.
I have a similar application and I think the WebBrowser control works very well. If you think it's what you need, I would for it and there's many other applications that do something similar. You can call Javascript functions in the HTML page from C# using HtmlDocument.InvokeScript(), and C# from Javascript using window.external and having this two-way communication makes life simple.
Users do not need IIS installed as you're not running a web server, just displaying content using HTML.
I would go for the built-in IE control rather than webkitdotnet to be honest. Although WebKit itself is superior to IE, the webkitdotnet project at version 0.5 it doesn't have the C#<> JavaScript communication or DOM access and it seems hard to tell if it's still being actively developed. It'll be great if/when it gets feature parity as IE is obviously far from perfect, but the advantage of the built-in IE control is every user of your app will have it already installed and the WebBrowser control is well tested. There are some disadvantages I've found:
IE versions may range from 6 to 9, so you'll to test to make sure your content works in all (as with a website).
There's a bug in IE (at least up to 8) that relative links do not work in combination with a <base href="file://...">. This can stop you being able to use relative links in your local HTML documents.
Sometimes pages display differently inside the WebBrowser control than they do out of it. For instance, http://bugs.jquery.com/ticket/7104 is one and I've come across another similar bug affecting cufon.
For compatibility reasons, even if your users install IE > 7 the WebBrowser control will still render your content in IE7 rendering mode by default. This is different to standalone IE which renders in the most-standard mode by default, so it can catch you out if you're not expecting it. You can change this by adding <meta http-equiv="X-UA-Compatible" tag if you want, though I actually found it makes life easier as it reduces the amount of different versions you've got to test against.

Categories