This is a migrated thread and some comments may be shown as answers.

set user controls's properties which is created dynamically

1 Answer 40 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Golu
Top achievements
Rank 1
Golu asked on 14 May 2009, 06:58 AM

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

1 Answer, 1 is accepted

Sort by
0
Obi-Wan Kenobi
Top achievements
Rank 1
answered on 14 May 2009, 01:06 PM
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.... 

Tags
Dock
Asked by
Golu
Top achievements
Rank 1
Answers by
Obi-Wan Kenobi
Top achievements
Rank 1
Share this question
or