Archives / 2004 / May
  • Calendar ID attribute not equal to ClientId

    WebControls generally render the Id attribute as the ClientId value so that they can be unique from a DOM perspective. The Calendar Control does not seem to follow this.

    For example, if you have a Calendar Control Calendar1 in an ascx page WebUserControl, instead of rendering the Id as WebUserControl1_Calendar1 on the parent page, it simply renders it as Calendar1.

    When developing a custom webcontrol that “looks at” other controls, it becomes impossible to use the getElementById property on the the calendar control as the ID rendered is different from what you are expecting.