Search code examples
c#asp.netcustom-controlscustom-server-controlscheckboxlist

During which phase of the Asp.net control lifecycle or event the client,id are resolved


I developed a server control which is custom control inheriting from checkboxlist and implements the IScriptControl i use the controls id, clientId to set some properties used for rendering in client during the controls constructor but gosh both are null when i debugged them. So there should be something wrong , what is it?


Solution

  • It is during the Pre_Render stage that you can get the actual clientID and ID properties

    public override void Pre_Render()
    {
    
    //control.ClientID and control.ID are available now
    
    }