Author: amintaheri | Posted on: 12/7/2009 10:34:13 PM | Views : 259

Hello,
I was wondering if you could assist in how to dynamically cast different classes of User Controls.


For example, I have User Control 1, 2 and 3 as exmpty files
<%@ Control ClassName="MyControl1" Language="C#" AutoEventWireup="true" CodeFile="MyControl1.ascx.cs" Inherits="controls_MyControl1" %>
<%@ Control ClassName="MyControl2" Language="C#" AutoEventWireup="true" CodeFile="MyControl2.ascx.cs" Inherits="controls_MyControl3" %>
<%@ Control ClassName="MyControl3" Language="C#" AutoEventWireup="true" CodeFile="MyControl3.ascx.cs" Inherits="controls_MyControl3" %>
They all inherit from System.Web.UI.UserControl, code behind has one public property.


Now in the web form code
It dynamically gets chosen and loaded based on a user actio ...

Go to the complete details ...