Is there any way to I add my custom controls inside Microsoft.Reporting.WebForms.ReportViewer contol.
I am developing ASP.NET web app and I want to add my custom controls inside toolBar of reportviewer.
Reading this blogspot it looks like that is possible in WinForms.
So I start coding my own RerpotViewerClass that inherits ReportViewer and I get stacked at start.
Looks like I can't override OnControlAdded method on WebForms ?
Shod I then use OnLoad() or any other ?
public class ReportViewerToolbarExtension : Microsoft.Reporting.WebForms.ReportViewer
{
protected override void OnControlAdded(ControlEventArgs e)
{
base.OnControlAdded(e);
}
}
Raisse error
'Microsoft.Reporting.WebForms.ReportViewer' does not contain a definition for 'OnControlAdded'
Also "ControlEventArgs" is misery part for me ?
When I try to implement SetToolStripItems(Control c)
I can't use ToolStripItemCollection also Toolstrip becuse they are belong to namespace System.Windows.Forms.
Should I reference WinForms or there are analog controls inside Web namespace ?
Unfortunately it is not possible to customize the web report viewer toolbar. By looking at the disassembled code you can see that the ToolbarControl used is a custom one and it is a internal sealed class and you can only hide or show the toolbar.
However it is possible for you to hide the toolbar and create your own that implements the same functionality as the existing one and your own controls.
This is the suggested route by Microsoft.
If you want a different toolbar implementation, you can create a custom toolbar to replace the default toolbar.
This is found at: http://msdn.microsoft.com/en-us/library/ms251670.aspx
What I would do is disassemble the code and re-implement it again as a public class with all the child classes which from my first look don't seem to have anything too complicated or difficult to do.
Also it would be possible to add it through the front end by editing the DOM using tools like jquery or just the DOM api. The web developer post below demonstrates how you could do that. Please bear in mind the implications of that if you want server side controls to be added to the toolbar you will need to make sure you dont invalidate the view state and that they work correctly.
Please see the following post hosted on the asp.net forum for a similar question.
Useful disassemble tools.
Hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With