tags:

views:

40

answers:

0

How do I correctly derive from a script control? Especially how to correctly define the script descriptors.

Let's say, I have a MyScriptControl class implementing IScriptControl:

public IEnumerable<ScriptDescriptor> GetScriptDescriptors()
{
    ScriptControlDescriptor descriptor = new ScriptControlDescriptor(GetType().FullName, ClientID);
    descriptor.AddComponentProperty("someChildControl", FindControl("SomeControlID").ClientID);
    descriptor.AddComponentProperty("otherChildControl", FindControl("OtherControlID").ClientID);
    descriptor.AddElementProperty("someProperty", "someValue");

    yield return descriptor;
}

In the derived class, how do I correctly overwrite the GetScriptDescriptors method? Should I just call base.GetScriptDescriptors, enumerate through them and exchange the Type name everywhere? Or is there a more clean feeling approach to that?

Thanks in advance,

Sebastian

related questions