Show Crystal report reportviewer from asp.net server side button click using ScriptManager.RegisterStartupScript inside update panel
Method 1:
public void showReportModified(string pageUrl, string param, System.Type cType, Page oPage, Control ctrl)
{
ScriptManager.RegisterStartupScript(ctrl, typeof(string), "redirect", "window.open('" + pageUrl + param + "');", true);
}
Method 2:
public void showReport(string pageUrl, string param, System.Type cType, Page oPage)
{
string url = ResolveClientUrl(pageUrl) + param;
//for (int i = 0; i < param.Length; i++)
//{
// url += pageUrl + Server.UrlEncode(param[i]);
//}
ClientScriptManager crScript = oPage.ClientScript;
//Type cType = this.GetType();
string script = @"<script language=javascript>window.open('" + url + "')</script>";
if (!crScript.IsClientScriptBlockRegistered(cType, "ViewReport"))
crScript.RegisterClientScriptBlock(cType, "ViewReport", script);
}
Method 2:
public void showReport2(string pageUrl, string param, System.Type cType, Page oPage)
{
string url = ResolveClientUrl(pageUrl) + param;
//for (int i = 0; i < param.Length; i++)
//{
// url += pageUrl + Server.UrlEncode(param[i]);
//}
ClientScriptManager crScript = oPage.ClientScript;
//Type cType = this.GetType();
string script = @"<script language=javascript>window.open('" + url + "')</script>";
if (!crScript.IsClientScriptBlockRegistered(cType, "ViewReport2"))
crScript.RegisterClientScriptBlock(cType, "ViewReport2", script);
}
Method 1 Example:
string URL = ResolveUrl("~/Report/Viewers/ReportViewer.aspx?ReportType=RequisitionNumberReport&RequisitionNumber=" + reqNo + "");
//ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "newWindow", URL, true);
showReportModified(URL, "", this.GetType(), this.Page, UpdatePanel1);
public void showReportModified(string pageUrl, string param, System.Type cType, Page oPage, Control ctrl)
{
ScriptManager.RegisterStartupScript(ctrl, typeof(string), "redirect", "window.open('" + pageUrl + param + "');", true);
}
Method 2:
public void showReport(string pageUrl, string param, System.Type cType, Page oPage)
{
string url = ResolveClientUrl(pageUrl) + param;
//for (int i = 0; i < param.Length; i++)
//{
// url += pageUrl + Server.UrlEncode(param[i]);
//}
ClientScriptManager crScript = oPage.ClientScript;
//Type cType = this.GetType();
string script = @"<script language=javascript>window.open('" + url + "')</script>";
if (!crScript.IsClientScriptBlockRegistered(cType, "ViewReport"))
crScript.RegisterClientScriptBlock(cType, "ViewReport", script);
}
Method 2:
public void showReport2(string pageUrl, string param, System.Type cType, Page oPage)
{
string url = ResolveClientUrl(pageUrl) + param;
//for (int i = 0; i < param.Length; i++)
//{
// url += pageUrl + Server.UrlEncode(param[i]);
//}
ClientScriptManager crScript = oPage.ClientScript;
//Type cType = this.GetType();
string script = @"<script language=javascript>window.open('" + url + "')</script>";
if (!crScript.IsClientScriptBlockRegistered(cType, "ViewReport2"))
crScript.RegisterClientScriptBlock(cType, "ViewReport2", script);
}
Method 1 Example:
string URL = ResolveUrl("~/Report/Viewers/ReportViewer.aspx?ReportType=RequisitionNumberReport&RequisitionNumber=" + reqNo + "");
//ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "newWindow", URL, true);
showReportModified(URL, "", this.GetType(), this.Page, UpdatePanel1);
Comments
Post a Comment