report viewer is blank - asp.net

work with visual studio 2012. I need to load my report viewer inside a div in my web page. But it would be blank. It works fine a separate web page alone, but when I want to load it inside a section inside my content page, it is blank. The part of my code which works with report viewer:
// add a div dynamically
HtmlGenericControl div = new HtmlGenericControl("div");
div.Attributes.Add("id", "chart05");
div.Attributes.Add("runat", "server");
div.Attributes["class"] = "chartItem";
sanaChartsContainer.Controls.Add(div);
Microsoft.Reporting.WebForms.ReportViewer viewer = new Microsoft.Reporting.WebForms.ReportViewer();
viewer.Attributes.Add("id", "ReportViewer");
viewer.Attributes.Add("runat", "server");
viewer.Attributes.Add("Font-Names", "Verdana");
viewer.Attributes.Add("Font-Size", "8pt");
viewer.Attributes.Add("Height", "50px");
viewer.Attributes.Add("ProcessingMode", "Remote");
viewer.Attributes.Add("WaitMessageFont-Name", "Verdana");
viewer.Attributes.Add("WaitMessageFont-Size", "14pt");
viewer.Attributes.Add("Width", "50px");
viewer.Attributes.Add("AsyncRendering", "false");
viewer.ServerReport.Refresh();
viewer.ShowParameterPrompts = false;
Uri baseUri = new Uri("http://mdb165.cbi.net/reportserver");
viewer.ServerReport.ReportServerUrl = baseUri;
viewer.ServerReport.ReportPath = "/SanaII/report005";
System.Web.UI.ScriptManager scriptManager = new ScriptManager();
Page page = new Page();
System.Web.UI.HtmlControls.HtmlForm form = new HtmlForm();
//div.Controls.Add(scriptManager);
div.Controls.Add(viewer);
My web config is:
<configuration>
<system.web>
<compilation debug="true">
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
</buildProviders>
</compilation>
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" validate="false"/>
</httpHandlers>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
</handlers>
</system.webServer>
</configuration>
I also added script manager to my page,
but report viewer is blank.
I also tried to load it directly in my content page as below shows:
but this is also doesn't work and is blank.
Please give me help.

Have you tried adding if(!IsPostBack) in your Page_Load?
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
SetDate();
BindCustomerCategory();
BindUtility();
}
}
OR if this will not work. Double check the aspx of your report page you might forgot something there..

Related

body of report not visible

Using Visual Studio 2015 mvc 5 application. I have created an SSRS report with Visual Studio 2012 that does not take any parameters (yet). I used nuget to add ReportViewerForMvc. I went through an online tutorial to create ReportTemplate.aspx etc. I'm using Forms Authentication so I changed my data sources to use a static SQL Login in SSRS. When I run the report manually I get 151 pages. When I run it through the application the toolbar at the top reads 1 of 151 pages. However, I can't see the body of the report and all the buttons on the toolbar are disabled. I've been fiddling with the control properties in the ReportTemplate.aspx.cs (code behind) and the ReportTemplate.aspx but nothing seems to change it.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
try
{
String reportFolder = System.Configuration.ConfigurationManager.AppSettings["SSRSReportFolder"].ToString();
String reportUri = System.Configuration.ConfigurationManager.AppSettings["SSRSReportUri"].ToString();
rvSiteMapping.Height = Unit.Pixel(2000);
rvSiteMapping.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
rvSiteMapping.ServerReport.ReportServerUrl = new Uri(reportUri); // Add the Reporting Server URL
rvSiteMapping.ServerReport.ReportPath = String.Format("/{0}/{1}", reportFolder, Request["ReportName"].ToString());
rvSiteMapping.ServerReport.Timeout = 320000;
rvSiteMapping.ServerReport.Refresh();
rvSiteMapping.ShowReportBody = true;
rvSiteMapping.ShowToolBar = true;
rvSiteMapping.SizeToReportContent = true;
rvSiteMapping.Enabled = true;
rvSiteMapping.Visible = true;
}
catch (Exception ex)
{
Console.Write(ex.Message);
}
}
}
Package Entries:
<package id="MicosoftReportViewerWebForms_v11" version="1.0.1" targetFramework="net451" />
<package id="ReportViewerForMvc" version="1.0.0" targetFramework="net451" />
Web.Config:
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" validate="false" />
</httpHandlers>
...
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</handlers>
Thanks
Lee

Crystal Report Image Issue

Crystal Report......Web Application MVC
I am trying to get Image to displayed.
Logo of company instead it is showing image alt="Image". By checking inspecting element I came to know that the src="CrystalImageHandler.aspx?dynamicimage=cr_tmp_image_d6cbdac3-0385-4ffd-a368-5a514303cb66.png"
. I tried hard to get it rectified by searching on many sites but could get...
any one who know this issue...
Thanks
Hi I have struggled with similar issue for quite some time.
I hope this solution might help you.
Web Config Changes:
<httpHandlers>
<add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />
</httpHandlers>
<handlers>
<remove name="CrystalImageHandler.aspx_GET" />
<add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" preCondition="integratedMode"/>
</handlers>
Note*: Handler Path field didn't had ".aspx" extension.
Add this block of code to you global.asax.cs
protected void Application_BeginRequest(object sender, EventArgs e)
{
var p = Request.Path.ToLower().Trim();
if (p.EndsWith("/crystalimagehandler.aspx") && p != "/crystalimagehandler.aspx")
{
var fullPath = Request.Url.AbsoluteUri.ToLower();
var NewURL = fullPath.Replace(".aspx", "");
Response.Redirect(NewURL);
}
}
This would Help you to resolve the issue.

URL Routing not working on server in Asp.Net

Here DataList.aspx & Details.aspx is inside directory v1, so i tried routing in two ways but nothing is working on server.
Global.asax
protected void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes.MapPageRoute("Route1",
"Category/{Brand}.html","~/DataList.aspx");
RouteTable.Routes.MapPageRoute("Route2",
"Category/{Brand}/{Title}.html","~/v1/Details.aspx");
}
I am using this routing in hyperlink inside listview. Url is generated correctly, but when i click on link it shows
"404 - File or directory not found."
I have also added this in web.config
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlRoutingModule" />
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e42" />
</modules>
<handlers>
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e42" />
</handlers>
</system.webServer>

SharePoint 2013, custom IHttpModule NullReferenceException

Update: Problem solved. Read on.
Any idea why it's apparently not possible anymore to add custom IHttpModules?
My question is related to: HttpModule.Init - safely add HttpApplication.BeginRequest handler in IIS7 integrated mode
However this question is rather old, unanswered and has no SharePoint context. I CAN add my HttpModule to any standard ASP.NET WebForms page.
SharePoint is being hosted in IIS 8. AppPool runs in Integrated Mode. Framework level is 4.0+.
namespace My.Namespace
{
using System;
using System.Web;
public class CustomHttpModule : IHttpModule
{
private static readonly object mutex = new object();
private static bool _isInitialized;
public void Init(HttpApplication context)
{
if (!_isInitialized)
{
lock (mutex)
{
if (_isInitialized) return;
context.BeginRequest += BeginRequest;
_isInitialized = true;
}
}
}
private void BeginRequest(object sender, EventArgs e)
{
}
public void Dispose()
{
}
}
}
Result:
[NullReferenceException: Object reference not set to an instance of an object.]
System.Web.PipelineModuleStepContainer.GetEventCount(RequestNotification notification, Boolean isPostEvent) +30
System.Web.PipelineStepManager.ResumeSteps(Exception error) +1098
System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb) +135
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +604
The web.config looks as follows:
<system.webServer>
<!-- further elements omitted -->
<modules runAllManagedModulesForAllRequests="true">
<remove name="AnonymousIdentification" />
<remove name="FileAuthorization" />
<remove name="Profile" />
<remove name="WebDAVModule" />
<remove name="Session" />
<add name="SPNativeRequestModule" preCondition="integratedMode" />
<add name="SPRequestModule" preCondition="integratedMode" type="Microsoft.SharePoint.ApplicationRuntime.SPRequestModule, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add name="SharePoint14Module" preCondition="integratedMode" />
<add name="StateServiceModule" type="Microsoft.Office.Server.Administration.StateModule, Microsoft.Office.Server, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="PublishingHttpModule" type="Microsoft.SharePoint.Publishing.PublishingHttpModule, Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="DesignHttpModule" preCondition="integratedMode" type="Microsoft.SharePoint.Publishing.Design.DesignHttpModule, Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="FederatedAuthentication" type="Microsoft.SharePoint.IdentityModel.SPFederationAuthenticationModule, Microsoft.SharePoint.IdentityModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="SessionAuthentication" type="Microsoft.SharePoint.IdentityModel.SPSessionAuthenticationModule, Microsoft.SharePoint.IdentityModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="SPWindowsClaimsAuthentication" type="Microsoft.SharePoint.IdentityModel.SPWindowsClaimsAuthenticationHttpModule, Microsoft.SharePoint.IdentityModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="SPApplicationAuthentication" type="Microsoft.SharePoint.IdentityModel.SPApplicationAuthenticationModule, Microsoft.SharePoint.IdentityModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="Session" type="System.Web.SessionState.SessionStateModule" />
<add name="CustomModule" type="My.Namespace.CustomHttpModule, My.Namespace, Version=1.0.0.0, Culture=neutral, PublicKeyToken=066b2229567b6747" />
</modules>
<!-- further elements omitted -->
</system.webServer>
As soon as I don't attach to the BeginRequest event anymore the page works again. But obviously my http module is rendered useless.
Edit 2013.09.19: Init() is being called twice upon application start. If I attach my event only on the second call the application works but the event doesn't fire.
Edit 2013.09.20: Problem presumably solved. The fact that my Init() method is triggered twice (and no Dispose() is called in between) led me to the assumption there might actually be two co-existing instances of my IHttpModule. And while my previous observation showed that the second instance can have the event attached (not firing, but no negative impact on the application as well) - it apparently is not true vice versa (which is the case with my static _isInitialized "lock").
**So both instances of the IHttpModule need to have the same "configuration" (eventhandlers attached). It is totally normal to have more than one HttpApplication instance running. That's something ASP.NET (or IIS) does internally for optimization purposes. That's the key thing to remember :)
Problem solved. Edited question. See Edit 2013.09.20.

Url Routing for the page inside a folder in asp.net 4.0?

I am trying to implement Url routing in asp.net 4.0. I just a created a small test application. I am trying to browse the pages kept inside the folder. It works fine when i am running in Visual studio..but when i hosted the application in IIS7 then it showed an error.
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
The code i used is. (i am using master page too.)
protected void Application_Start(object sender, EventArgs e)
{
CustomRouteTable(RouteTable.Routes);
}
void CustomRouteTable(RouteCollection routes)
{
routes.MapPageRoute("Telugu", "Movie/Telugu", "~/Telugu/Telugu.aspx");
}
in my default.aspx page i kept a button and on click of the button i wrote.
protected void btnTelugu_Click(object sender, ImageClickEventArgs e)
{
Response.RedirectToRoute("Telugu");
}
where am i going wrong???
Thanks.
protected void btnTelugu_Click(object sender, ImageClickEventArgs e)
{
Response.RedirectToRoute("Movie/Telugu");
}
Have you updated your web.config to support URL Routing on IIS7.
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRoutingModule"
type="System.Web.Routing.UrlRoutingModule,
System.Web.Routing, Version=3.5.0.0,
Culture=neutral,
PublicKeyToken=31BF3856AD364E35" />
<!-- ... -->
</modules>
<handlers>
<add name="UrlRoutingHandler"
preCondition="integratedMode"
verb="*" path="UrlRouting.axd"
type="System.Web.HttpForbiddenHandler,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
<!-- ... -->
</handlers>
</system.webServer>
Here is the artice where I c/p the example from, that will give you more details.
http://msdn.microsoft.com/en-us/magazine/dd347546.aspx

Resources