views:

13

answers:

0

Hi!

I have some control that I add dynamically to my page:

public partial class _Default : Page
{     
    protected override void CreateChildControls()
    {
        base.CreateChildControls();

        var testControl = new TestControl
        {
            SkinID = "TestSkin"                
        };
        Controls.Add(testControl);
    }
}

I have the following skin file for this control:

<cc:TestControl runat="server" SkinID="TestSkin" TestProperty="LALALA" />

But TestProperty is null (if control is static all works):

public class TestControl : LinkButton
{  
    public string TestProperty { get; set; }

    protected override void OnPreRender(EventArgs e)
    {
        if (String.IsNullOrEmpty(TestProperty))
        {
            throw new ArgumentNullException("TestProperty");
        }
    }      
}

Any ideas about how to fix it?