I have a number of classes with the following pattern:
namespace MyCompany.MyApplication.ReportingClasses
{
public class ReportingClassName
{
public string HTMLReportString {get; private set;}
ReportingClassName()
{
// Use linq to generate report;
// Populate gridview, pass object to function which returns HTMLString;
// set HTMLReportString property;
}
}
}
Each class holds a different linq query based on the report. I want to load the class dynamically from a list of reports in a drop down box. I store the AsseblyQualifiedName as well as a display name to populate the DDL. I have used reflection based on the posts that I have seen, but I can't seem to perform what I would like;
string myAssembly = "AssemblyName"; // This is static;
string myClass = "AssemblyQualifiedName"; // This value from DDL;
var myObject = Activator.CreateInstance(AssemblyName, AssemblyQualifiedName);
string propertyValue = myObject.HTMLReportString;
"UpdatePanelID".InnerHTML = propertyValue;
Is what I am trying to accomplish possible?