我有一个Silverlight应用程序,它有一个RadHtmlPlaceholder指向ssrs以显示如下报告:
<telerik:RadHtmlPlaceholder SourceUrl="http://serverName/ReportServer/Pages/ReportViewer.aspx?/Northwind/Employees&rs:Command=render" />
这样可以正常工作,但是当我有一个允许您向下钻取以显示子报告的报告时,无法再次加载整个批次,无法返回到父报告。似乎没有打开导航后退按钮工具栏选项的选项,我已经看到了通过使用javascript在历史记录中将窗口位置设置回来实现后退按钮的其他方法,但显然这不会在Silverlight应用程序中工作。反正有没有实现导航后退按钮?
答案 0 :(得分:1)
在Telerik论坛中查看此主题:http://www.telerik.com/community/forums/silverlight/htmlplaceholder/html-place-holder-back-forward-refresh.aspx
基本上你需要从演示者那里获得IFrame的句柄并注入一些JavaScript。 history对象还有一个length属性,可用于评估是否应启用按钮。
public MainPage()
{
InitializeComponent();
// Get the IFrame from the HtmlPresenter
HtmlElement iframe = (HtmlElement)htmlPlaceholder.HtmlPresenter.Children[0];
// Set an ID to the IFrame so that can be used later when calling the javascript
iframe.SetAttribute("id", "myIFrame");
}
private void Refresh_Click(object sender, RoutedEventArgs e)
{
// Code to be executed
string code = "document.getElementById('myIFrame').contentWindow.location.reload(true);";
HtmlPage.Window.Eval(code);
}
private void Back_Click(object sender, RoutedEventArgs e)
{
// Code to be executed
string code = "document.getElementById('myIFrame').contentWindow.history.back();";
HtmlPage.Window.Eval(code);
}
private void Forward_Click(object sender, RoutedEventArgs e)
{
// Code to be executed
string code = "document.getElementById('myIFrame').contentWindow.history.forward();";
HtmlPage.Window.Eval(code);
}
}