Hi all,
Good day. I have trouble in loading my custom controls. The plot is
like this, the namespace and the class name will be given in a database when
loading the page (fully pagelet) i want to use this settings from the
database and load the control into the page. I couldnt do this using
Assembly.LoadFrom and CreateInstance methods because the CreateInstance
returns a Object and I cant add this as simply using Page.Controls.Add. I
came across this LoadControl metod but it gets the path of a ascx file as
opposed to a custom server control what iam trying to load. Please help me
in this.

What iam doing as code :

<%@ Page Language="C#" %>
<script runat="server">
public void Page_Load(Object sender,EventArgs e) {
System.Reflection.Assembly asm =
System.Reflection.Assembly.LoadFrom(Page.MapPath("/bin/MyAssembly.dll"));
Control gc = asm.CreateInstance("MyControl"); // Get error, since it
cannot convert Object to Control //
Page.Controls.Add(gc);
}
</script>
<html>
<head>
<title>Test Dyanic Control Loading</title>
</head>
<body>

</body>
</html>

Thanking you in advance.

CreProDes