SkinId in UserControl

2 posts, 0 answers
  1. lupotana
    lupotana avatar
    73 posts
    Member since:
    Nov 2006

    Posted 11 Jun 2010 Link to this post

    I want use a RadMenu in an UserControl.
    I load dynamically the Menu Items in Page_Load Event and I want to set dynamically the SkinId of RadMenu.

    If I set the SkinId in Page_Load I have this problem.
    "The 'SkinId' property can only be set in or before the Page_PreInit event for static controls. For dynamic controls, set the property before adding it to the Controls collection."

    But Usercontol don't have the Pre_Init event.

    How do I set dynamically SkinId of my RadMenu ?


  2. Veronica
    Veronica avatar
    1213 posts

    Posted 15 Jun 2010 Link to this post

    Hi lupotana,

    I've created a sample project to test your case. 

    You need to set the SkinID of the Web User Control before adding it to the control collection:

    protected void Page_Load(object sender, EventArgs e)
            var userControl = Page.LoadControl("RadMenu.ascx");
            userControl.FindControl("RadMenu1").SkinID = "Office";

    Find the full code in the attached .zip file.

    Hope this helps.

    All the best,
    Veronica Milcheva
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top