5 Answers, 1 is accepted
0
Hello Sentil,
Regards,
Peter
Telerik
The NavigateToUrl action URL is used in the NavigateToUrl() javascript function. If the default behavior of this function is not covering your requirements it could be easily overridden as shown in the following code snippet:
<
telerik:ReportViewer
ID
=
"ReportViewer1"
runat
=
"server"
/>
<
script
type
=
"text/javascript"
>
ReportViewer.prototype.OnReportLoadedOriginal = ReportViewer.prototype.OnReportLoaded;
ReportViewer.prototype.OnReportLoaded = function () {
this.OnReportLoadedOriginal();
var iframeID = this.clientID + "ReportFrame";
var iframe = document.getElementById(iframeID);
var wnd = iframe.contentWindow;
alert('loaded');
wnd.NavigateToUrl = function (url) { alert(url); window.open(url,"_blank") };
}
</
script
>
Regards,
Peter
Telerik
New HTML5/JS REPORT VIEWER with MOBILE AND TOUCH SUPPORT available in Telerik Reporting Q3 2013! Get the new Reporting version from your account or download a trial.
0
Sentil
Top achievements
Rank 1
answered on 25 Nov 2013, 03:22 PM
Hi Peter
Thanks in aspx page i have your code
i am using dynamic table with PictureBox and add image url
pb = new Telerik.Reporting.PictureBox();
myImg = Image.FromFile(@"" + System.Web.HttpContext.Current.Server.MapPath("myimage.png"));
UrlAction1 = new Telerik.Reporting.NavigateToUrlAction();
UrlAction1.Url = myurl; // How to use our script to call my url
pb.Action = UrlAction1;
Senthil
Thanks in aspx page i have your code
<
telerik:ReportViewer
ID
=
"ReportViewer1"
runat
=
"server"
/>
<
script
type
=
"text/javascript"
>
ReportViewer.prototype.OnReportLoadedOriginal = ReportViewer.prototype.OnReportLoaded;
ReportViewer.prototype.OnReportLoaded = function () {
this.OnReportLoadedOriginal();
var iframeID = this.clientID + "ReportFrame";
var iframe = document.getElementById(iframeID);
var wnd = iframe.contentWindow;
alert('loaded');
wnd.NavigateToUrl = function (url) { alert(url); window.open(url,"_blank") };
}
</
script
>
pb = new Telerik.Reporting.PictureBox();
myImg = Image.FromFile(@"" + System.Web.HttpContext.Current.Server.MapPath("myimage.png"));
UrlAction1 = new Telerik.Reporting.NavigateToUrlAction();
UrlAction1.Url = myurl; // How to use our script to call my url
pb.Action = UrlAction1;
Senthil
0
Hi Sentil,
We are not sure that we have correctly understood your last inquiry. Generally with the provided function override you can replace the out of the box NavigateToUrl functionality and handle it accordingly. Still we are not sure why you want to override it because you can set NavigateToUrlAction.Target Property to UrlTarget.NewWindow and avoid the JavaScript override.
Give it a try and if you need additional assistance please elaborate in details what is your goal.
Regards,
Peter
Telerik
We are not sure that we have correctly understood your last inquiry. Generally with the provided function override you can replace the out of the box NavigateToUrl functionality and handle it accordingly. Still we are not sure why you want to override it because you can set NavigateToUrlAction.Target Property to UrlTarget.NewWindow and avoid the JavaScript override.
Give it a try and if you need additional assistance please elaborate in details what is your goal.
Regards,
Peter
Telerik
New HTML5/JS REPORT VIEWER with MOBILE AND TOUCH SUPPORT available in Telerik Reporting Q3 2013! Get the new Reporting version from your account or download a trial.
0
Sentil
Top achievements
Rank 1
answered on 28 Nov 2013, 01:02 PM
Hi Peter
I think i did not give proper information, i used NavigateToUrlAction.Target Property which is opening in a new window, as a new tab, but my requirement is to open new window as a popup where i need to set height , width , etc like we open using window.open
Thats why i gave below code sample, where i click the image i need to open a popup where height and width should be different(like we open using window.open) and not a regular window in a separate tab
pb = new Telerik.Reporting.PictureBox();
myImg = Image.FromFile(@"" + System.Web.HttpContext.Current.Server.MapPath("myimage.png"));
UrlAction1 = new Telerik.Reporting.NavigateToUrlAction();
UrlAction1.Url = myurl; // How to use our script to call my url
pb.Action = UrlAction1;
Senthil
I think i did not give proper information, i used NavigateToUrlAction.Target Property which is opening in a new window, as a new tab, but my requirement is to open new window as a popup where i need to set height , width , etc like we open using window.open
Thats why i gave below code sample, where i click the image i need to open a popup where height and width should be different(like we open using window.open) and not a regular window in a separate tab
pb = new Telerik.Reporting.PictureBox();
myImg = Image.FromFile(@"" + System.Web.HttpContext.Current.Server.MapPath("myimage.png"));
UrlAction1 = new Telerik.Reporting.NavigateToUrlAction();
UrlAction1.Url = myurl; // How to use our script to call my url
pb.Action = UrlAction1;
Senthil
0
Hello Sentil,
Check out the following code snippet that shows how to override the NavigateToUrl function to open the url in a pop up window. For more information on the windows.open overloads check out the Window open() Method article.
Regards,
Peter
Telerik
Check out the following code snippet that shows how to override the NavigateToUrl function to open the url in a pop up window. For more information on the windows.open overloads check out the Window open() Method article.
<telerik:ReportViewer ID=
"ReportViewer1"
runat=
"server"
/>
<script type=
"text/javascript"
>
ReportViewer.prototype.OnReportLoadedOriginal = ReportViewer.prototype.OnReportLoaded;
ReportViewer.prototype.OnReportLoaded =
function
() {
this
.OnReportLoadedOriginal();
var
iframeID =
this
.clientID +
"ReportFrame"
;
var
iframe = document.getElementById(iframeID);
var
wnd = iframe.contentWindow;
wnd.NavigateToUrl =
function
(url) {
window.open(url,
"_blank"
,
"toolbar=no, scrollbars=yes, resizable=yes, top=500, left=500, width=400, height=400"
);
};
}
</script>
Regards,
Peter
Telerik
New HTML5/JS REPORT VIEWER with MOBILE AND TOUCH SUPPORT available in Telerik Reporting Q3 2013! Get the new Reporting version from your account or download a trial.