or
Telerik.Reporting.Processing.RenderingResult result = TelContractrp.RenderReport(
"DOCX"
, TelContractirs,deviceInfo);
string
dContract = DateTime.Now.ToString().Replace(
"/"
,
""
);
dContract = dContract.Substring(0, 12);
dContract = dContract.Replace(
":"
,
""
);
string
fileName2 = result.DocumentName +
"_"
+ dContract +
"."
+ result.Extension;
string
filePath2 = System.IO.Path.Combine(saveLocation, fileName2);
FileStream fs =
new
FileStream(filePath2, FileMode.Create);
fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
fs.Close();
System.Diagnostics.Process p =
new
System.Diagnostics.Process();
p.StartInfo.UseShellExecute =
true
;
p.StartInfo.FileName = filePath2;
p.Start();
private void TestReport1_NeedDataSource(object sender, EventArgs e)
{
//Take the Telerik.Reporting.Processing.Report instance
Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender;
string stsql = "SELECT M.ManagerID, C.FirstName + ' ' + C.LastName AS Name, E.Gender FROM (SELECT DISTINCT ManagerID FROM HumanResources.Employee) AS M INNER JOIN";
stsql += " HumanResources.Employee AS E ON M.ManagerID = E.EmployeeID INNER JOIN Person.Contact AS C ON E.ContactID = C.ContactID WHERE (E.Gender = N'F') ORDER BY Name";
this.sqlDataSource2.SelectCommand = stsql;
}
Protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Report1 myReports = new Report1();
Reports.TestReport1 myReport = new Reports.TestReport1();
string stsql = "SELECT M.ManagerID, C.FirstName + ' ' + C.LastName AS Name, E.Gender FROM (SELECT DISTINCT ManagerID FROM HumanResources.Employee) AS M INNER JOIN";
stsql += " HumanResources.Employee AS E ON M.ManagerID = E.EmployeeID INNER JOIN Person.Contact AS C ON E.ContactID = C.ContactID WHERE (E.Gender = N'F') ORDER BY Name";
// Need help here to filter SQLDatasource2..
}
}
Telerik.Reporting.Processing.ReportProcessor TelContractrp =
new
Telerik.Reporting.Processing.ReportProcessor();
System.Collections.Hashtable deviceInfo =
new
System.Collections.Hashtable();
Telerik.Reporting.InstanceReportSource TelContractirs =
new
Telerik.Reporting.InstanceReportSource();
TelContractirs.ReportDocument = currRpt;
Telerik.Reporting.Processing.RenderingResult result = TelContractrp.RenderReport(
"DOCX"
, TelContractirs,deviceInfo);
string
dContract = DateTime.Now.ToString().Replace(
"/"
,
""
);
dContract = dContract.Substring(0, 12);
dContract = dContract.Replace(
":"
,
""
);
string
fileName2 = result.DocumentName +
"_"
+ dContract +
"."
+ result.Extension;
string
filePath2 = System.IO.Path.Combine(saveLocation, fileName2);
FileStream fs =
new
FileStream(filePath2, FileMode.Create);
fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
fs.Close();
System.Diagnostics.Process p =
new
System.Diagnostics.Process();
p.StartInfo.UseShellExecute =
true
;
p.StartInfo.FileName = filePath2;
p.Start();
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
|