iframe not Rendering in .NET ReportViewer Web Control - c#

I have a .NET Webform ReportViewer control. When I run it locally everything is fine. But when deployed to a server it won't render. debugging on the browser shows that the iframe that handles everything is simply not present.
this is all in a custom control that was here before my time. So basically when the render method is called the custom control adds the controls to a panel control, then uses the HTMLWriter class so create a div, calls .Render() and then passes in the HTMLwriter. I used string comparison to see if the iframe was somehow being sanitized(for security) by the browser, but it is not. I have verified the server has v 8,9, and 10 of both ReportViewer.Common and ReportViewer.Webform. I have tried referencing all of these in my web.config and msproj references and still no joy. Its the weirdest thing, same microsoft library, 2 different boxes, writes two different HTML strings.
Anyone seen anything like this. I have definitely checked through SO and found most of it has to do with the missing assemblies from the GAC, but I am seeing all of them present. Environment issues are so frustrating!

So it looks like this was an environment issue after all and had nothing to do with the code. The custom control that contained the report viewer control was blocking it from allowing errors to bubble up since it was directly writing the render to HTML. It turned out to be Report Server permissions.

Related

How can I remotely take an accurate screenshot of a webpage by URL without WebBrowser?

I tried WebBrowser but any solution related to WebBrowser I find uses the exact same codes, WebBrowser.DrawToBitmap
Problem with that is, it gives out inaccurate results depending on URL, to what page actually would look like, sometimes even blank pages.
So I am looking for any alternate solution to WebBrowser if there is any.
It needs to run in background, as in not open any browser on screen, render it in background with all scripts and get an image.
If I understand what you're trying to do, you might be interested in a framework called PhantomJS, which is a WebKit "browser" engine which runs the pages without visually rendering them. It can be used to capture screens.
Now this technique requires JavaScript, but there is something called Selenium WebDriver to help you wrapping that. Users here at SO posted a simple example and this comment looks useful as it contains the list of required Packages.

WebBrowser control says "Navigation to the webpage was canceled"

I'm using Windows 10 and I already changed the registry keys so the WebBrowser control uses the latest version of IE.
I only seem to be getting this error for a specific site. Other sites seem to be loading fine. I'm also not getting this problem on IE. It's only on the WebBrowser control. This happens no matter how many times I reload the page.
This seems to be happening 90% of the times. There are some cases where the page actually loads. I'm not sure what I'm doing differently though, since my code is the same.

WebBrowser - Modal('Show') and Javascript

I'm using a standard WebBrowser control to perform various automated web requests. I am aware of the default IE 7 setting unless changed by registry, which I have done, and now use a mainly functional version of IE 10 embedded within my program.
Unfortunately, there are times when I need to click JS buttons to add data to the displayed webpage, and other times when there are Modal popups that require me to input information. Webbrowser chokes on this, and for the button, and popup, does nothing.
I am aware of the route of using ScriptInvoke to send my data, but I wondered if there is any way I can avoid this and just use the WebBrowser control as if it where a normal browser, that accepts the two described functions.
Thanks to all,
Stan.

RadToolTip's RenderControl method

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.

How can I load .ascx user control from console application or windows service?

We use ascx user controls as templates for documents (e.g. invoices).
Now I need to load,render to HTML, then transform to PDF these controls from windows service.
So, what's the correct way/workaround? TemplateControl.LoadControl(path) doesn't work.
To be perfectly honest, I don't know how to do this. However, if I was stuck with this problem, I think I'd download the ASP.NET MVC source, and see what they do to render a partial view (a partial view in MVC is essentially an .ascx control). The Render method on System.Web.Mvc.WebFormView might be a good starting place.
You're probably going about it the wrong way, to be honest. You should probably have your logic embedded in a library, and then have the user control interface with that library. Then, you could use that same logic to populate values on a form, or similar.
You're probably going to run into a lot of trouble trying to get the control to load, and deal with things that don't exist outside of ASP.Net, like session variables, and viewstate.
Generally, what you're asking for is a report, which is handled by something like Crystal Reports, or SQL Server Reporting Services.

Categories

Resources