| Invert |
Petr Jarkovsky
01/23/2007 07:59
ReportViewer and history
Hi,
I'm trying to write my own preview dialog using ReportViewer.
How can I find out the history position (if is 0 or last)?
I would like to enable or disable menu items / toolbar buttons for functions "Move backward" / "Move forwards".
Thank you.
|
Alexey Sarantsev
01/23/2007 20:19
ReportViewer and history
Hello Petr,
You do not need to find out history position. Your problem may be solved with the Actions mechanism. For example, you place the ReportViewer control and MainMenu with “Backward” and “Forward” MenuItems (backwardMenuItem and formardMenuItem) on your Form.
In order to make these MenuItems correspond to the “Backward” and “Forward” commands of the ReportViewer, you need to set conformity between the ManuItems and the corresponding Actions:
| Code: |
private void PreviewForm_Load(object sender, System.EventArgs e)
{
reportViewer.Actions["Backwards"].BindControl(backwardMenuItem);
reportViewer.Actions["Forward"].BindControl(forwardMenuItem);
}
|
In such case, these ManuItems will be automatically enabled and disabled.
Also, you can bind ToolBarButtons to Actions.
Best regards,
Alexey Sarantsev
|
Petr Jarkovsky
01/24/2007 07:36
ReportViewer and history
Thank you for your answer, but I'm using .NET 2.0 and ToolStripMenuItem.
Action.BindControl checks if the control is ToolBarButton or MenuItem (from .NET 1.1). So I will get an ArgumentException.
Thanks,
Petr Jarkovsky
|
Alexey Sarantsev
01/24/2007 22:02
ReportViewer and history
Hello Petr,
In order to bind Action to ToolStripButton you should implement the descendant from the PerpetuumSoft.Reporting.Windows.Forms.ActionBind abstract class. You can see the example of such implementation in http://www.perpetuumsoftware.com/support/ToolStripActionExample.zip example.
Best regards,
Alexey Sarantsev
|
Petr Jarkovsky
01/25/2007 06:10
ReportViewer and history
Thank you very much. This solution is OK.
|
Alexey Sarantsev
01/25/2007 18:02
ReportViewer and history
Hello Petr,
In case of any further questions, please feel free to contact us.
Best regards,
Alexey Sarantsev
|