set user controls's properties which is created dynamically

2 posts, 0 answers
  1. Golu
    Golu avatar
    41 posts
    Member since:
    Dec 2008

    Posted 14 May 2009 Link to this post

    Dear sir,
    how can we set dynamically created user controls's properties in dynamically created dock.

    dock is created dynamically and in it user controls.how can we set values dynamically loaded user controls's properties

    thanks with regards

  2. Obi-Wan Kenobi
    Obi-Wan Kenobi  avatar
    460 posts
    Member since:
    Aug 2007

    Posted 14 May 2009 Link to this post

    Here is a code which shows how to modify the properties of UserControl
    Page - codebehind:
       protected void Page_Init(object sender, EventArgs e)  
        {  
            RadDock dock = new RadDock();  
            dock.ID = dock.Title = "RadDockTemp";  
            RadDockZone1.Controls.Add(dock);  
            UserControl uc = (UserControl)Page.LoadControl("WebUserControl.ascx");  
            ((UserControlClassName)uc).MyButton.Text = "aaa";  
            dock.ContentContainer.Controls.Add(uc);  
        } 
    UserControl - codebehind:
     
    public partial class UserControlClassName : System.Web.UI.UserControl  
    {  
        public Button MyButton  
        {  
            get 
            {  
                //Button1 is placed in WebUserControl.ascx  
                return this.Button1;  
            }  
     
        } 
        public PageLoad.... 

Back to Top