按名称动态分配表单(assigning of forms by name dynamically)
所以我需要的是这样的东西。 我想调用与变量对应的Web报表。 因此,例如,如果变量值是Test。 我希望调用test.aspx表单。 我想知道这是否可行,所以我不必在报告名称之间切换并将它们分配给每个表单。
switch (reportName) { case reportName: report = new GWL.WebReports.Reports.reportName+".aspx"(); //<-- I need to evaluate something like this break; }So what I need is something like this. I want to call the web report form that corresponds to a variable. So for example if the variable value is Test. I want the test.aspx form to be called. I wonder if this is possible, so I don't have to switch between names of reports and assigning them to each and every form.
switch (reportName) { case reportName: report = new GWL.WebReports.Reports.reportName+".aspx"(); //<-- I need to evaluate something like this break; }最满意答案
好吧,我终于明白了。 我从来不知道我仍然可以使用我上一篇文章中使用的方法。
string reportName; Type CAType = Type.GetType("Namespace"+reportName); XtraReport report = (XtraReport)Activator.CreateInstance(CAType);Well I finally figured it out. I never knew that I can still use the approach that was used in my previous post..
string reportName; Type CAType = Type.GetType("Namespace"+reportName); XtraReport report = (XtraReport)Activator.CreateInstance(CAType);更多推荐
发布评论