Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.9k views
in Technique[技术] by (71.8m points)

c# - Telerik - Can I load a report definition from Database

I am working on a WebApplication, and including a Telerik-Report in it. The normal way as described works well.

Now I'm trying to load the report definition from a Database, instead of having a file (request from the boss). So far, I've made it work with a temp-file, code is below. But this is far from nice coding.

My question: can I somehow give a string or stream to the report (instead of a file)?

My current code looks like this:

private readonly string __path = "C:\my-temp-directory\Reports\";
protected void Page_Load(object sender, EventArgs e) {
    string contents =  /** Get XML from Database **/;
    File.WriteAllText(__path + "temp.trdx", contents);   // <-- This file I want to omit.
    if (!IsPostBack) {
        this.reportViewer1.ReportSource.Identifier = "temp.trdx";
        this.reportViewer1.ReportSource.IdentifierType = IdentifierType.TypeReportSource;
    }
}

Thanks.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...