or
public partial class MyReport : Telerik.Reporting.Report public string MyString { get { return "Demo Telerik Report"; } } public EntiteDatabase() { // // Required for telerik Reporting designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // }
}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();