Hello everyone,
I am currently facing with a problem in my wrapped reportviewer 10 control.
This is the error i got:
Cannot convert hosted control found using 'hosted_control_id' control ID to 'Microsoft.Reporting.WebForms.ReportViewer' type.
This is the way, i add the control to my project:
* I reference the needed assemblies to my project
* Then i add the ReportViewer with the asp.net wrapper to my project
After that I modify the code of the class like I read in other articles to prevent the error with the scriptmanager and to set the asyncpostbacktimeout:
extern alias ReportViewer10;
using System;
using System.ComponentModel;
using System.Linq;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using Gizmox.WebGUI.Common.Interfaces;
using Gizmox.WebGUI.Forms.Hosts;
namespace TIP.HCe.Common.GUI.WrappedControls
{
/// <summary>
/// Provides a Visual WebGui callable wrapper for Microsoft.Reporting.WebForms.ReportViewer.
/// </summary>
[ToolboxItem(true)]
public partial class ReportViewer2010Wrapper : AspControlBoxBase
{
public ReportViewer2010Wrapper()
{
InitializeComponent();
}
protected override void OnHostedPageLoadComplete(object sender, EventArgs e)
{
base.OnHostedPageLoadComplete(sender, e);
}
protected override void OnHostedControlLoad(object sender, EventArgs e)
{
base.OnHostedControlLoad(sender, e);
}
protected override void OnHostedControlPreRender(object sender, EventArgs e)
{
base.OnHostedControlPreRender(sender, e);
}
protected override void FireEvent(IEvent objEvent)
{
base.FireEvent(objEvent);
}
protected override HtmlForm CreateHostPageForm()
{
HtmlForm objForm = base.CreateHostPageForm();
ScriptManager objSm = objForm.Controls.OfType<ScriptManager>().FirstOrDefault();
//Wurde kein ScriptManager gefunden, wird ein neuer eingefügt.
if (objSm == null)
{
objSm = new ScriptManager();
objForm.Controls.Add(objSm);
}
//Gets or sets a value that indicates the time, in seconds, before asynchronous postbacks time out if no response is received.
objSm.AsyncPostBackTimeout = 100000;
return objForm;
}
}
}
Maybe someone had the problem before?
I also read in an other article that i have to add some asp code from a ascx file to my resx but my reportviewer class has no resx file. So i don't know to solve this problem.
Thanks,
Tom
EDIT:
This was the problem:
this.rv.ControlCode = resources.GetString("rv.ControlID");
I changed it to this and it worked.
this.rv.ControlCode = resources.GetString("rv.ID");