I'm having a problem since upgrading from 2008.1.415 to 2008.1.619 with a ComboBox not firing the SelectedIndexChanged event.
I traced it back to the ClientID of the combobox having changed since the new version - where previously it was the full control hierarchy eg mainPlaceHolder$cplTopPaneContent$frmSalaryHistory$gradeSelector$dropDown it is now being rendered as just gradeSelector$dropDown.
Having spent a while debugging the new version, i think the problem lies with the new CreateHeader and CreateFooter methods:
These methods make a reference to this.ClientID, and as they are being called while the control hierarchy is not yet finalised they can cause problems with caching of UniqueIDPrefixes for the controls.
This results in the controls being rendered with the wrong clientIDs and the events not firing. This is discussed on pages such as http://dotnetslackers.com/DataGrid/re-49612_Accessing_ClientID_or_UniqueID_too_early_can_cause_issues.aspx
It's not easy to reproduce this in a small project, as I think the control has to be in a nested hierarchy before it starts breaking, but if you just want the header to have the same ClientID as the combobox, but with "_Header" suffixed to it, is it not possible to change the above code to
and ASP.NET will take care of prefixing with the combobox's ID (as the header is a child control of the combobox)?
Thanks,
Stephen
I traced it back to the ClientID of the combobox having changed since the new version - where previously it was the full control hierarchy eg mainPlaceHolder$cplTopPaneContent$frmSalaryHistory$gradeSelector$dropDown it is now being rendered as just gradeSelector$dropDown.
Having spent a while debugging the new version, i think the problem lies with the new CreateHeader and CreateFooter methods:
private void CreateFooter() |
{ |
if (_footer == null) |
{ |
this._footer = new RadComboBoxHeaderFooterControl(); |
this.Controls.Add(Footer); |
Footer.ID = this.ClientID + "_Footer"; |
Footer.CssClass = RadComboBox.FooterCssClass; |
} |
} |
private void CreateHeader() |
{ |
if (_header == null) |
{ |
this._header = new RadComboBoxHeaderFooterControl(); |
this.Controls.Add(Header); |
Header.ID = this.ClientID + "_Header"; |
Header.CssClass = RadComboBox.HeaderCssClass; |
} |
} |
These methods make a reference to this.ClientID, and as they are being called while the control hierarchy is not yet finalised they can cause problems with caching of UniqueIDPrefixes for the controls.
This results in the controls being rendered with the wrong clientIDs and the events not firing. This is discussed on pages such as http://dotnetslackers.com/DataGrid/re-49612_Accessing_ClientID_or_UniqueID_too_early_can_cause_issues.aspx
It's not easy to reproduce this in a small project, as I think the control has to be in a nested hierarchy before it starts breaking, but if you just want the header to have the same ClientID as the combobox, but with "_Header" suffixed to it, is it not possible to change the above code to
private void CreateFooter() |
{ |
if (_footer == null) |
{ |
this._footer = new RadComboBoxHeaderFooterControl(); |
this.Controls.Add(Footer); |
Footer.ID = "_Footer"; |
Footer.CssClass = RadComboBox.FooterCssClass; |
} |
} |
private void CreateHeader() |
{ |
if (_header == null) |
{ |
this._header = new RadComboBoxHeaderFooterControl(); |
this.Controls.Add(Header); |
Header.ID = "_Header"; |
Header.CssClass = RadComboBox.HeaderCssClass; |
} |
} |
and ASP.NET will take care of prefixing with the combobox's ID (as the header is a child control of the combobox)?
Thanks,
Stephen