How to add a user control to PropertyDataControl



    I want to implement a custom property, which functions is: provide a input box to add list item and a repeater to render the list item. I want to use web user control to wrap the input box, add button and repeater. So I need add this user control to the custom property control. I have tried     

 this.Controls.Add(myusercontrol)  in CreateEditControls(), but it didn't work. I can't see any content when I use this custom property in edit mode.


#29907 May 22, 2009 6:35
  • Erik Nordin Wahlberg
    Member since: 2004

    Hi, this works for me.

    public MultiPageEdit usercontrol = new MultiPageEdit();
    public override void CreateEditControls()
    usercontrol = (MultiPageEdit)Page.LoadControl("~/somepath/MultiPageEdit.ascx");


    #29910 May 22, 2009 10:46
    Thanks a lot, it works!
    #29959 May 25, 2009 4:33