.Net 4.0 Telerik RadControls for ASP.NET Ajax version: 2013.3.1015.40
I'm using telerik:RadAjaxManager to update a RadGrid and RadComboBox after calling a server method via an asp:button. Once the grid has loaded, it calls the below javascript which is a snippet of the function that checks for any checked boxes client side. If I use the asp:button as the AjaxControlID to update RadComboBox, the method updates the combobox but var ddl returns null and I get the error "Uncaught TypeError: Cannot call method 'get_items' of null". However, if I update the RadComboBox via the OnNeedDataSource event of the updating RadGrid, I get the opposite. RadComboBox doesn't update, even though the method ran, but ddl populates as expected and the javascript methods can run.
function GridLoaded(sender, args) {
var ddl = $find("<%= RadComboBox.ClientID %>");
var items = ddl.get_items();
...
}
Which evaluates to:
function GridLoaded(sender, args) {
var ddl = $find("ctl00_PrimaryContent_RadComboBox");
var items = ddl.get_items();
...
}
I've tried encapsulating the javascript section in a RadCodeBlock and RadScriptBlock based on numerous other presented solutions with no improvement.
This functionality is working on a separate page with the only difference being the ComboBox is called from OnSelectedIndexChanged from one RadGrid to update another RadGrid.
I've checked here with no solution. telerik RadComboBox find Returns null - why?
I finally figured this one out got it working.
Apparently, RadAjaxManager wants to update the ComboBox as well for everything to work together.
<telerik:RadAjaxManager ID="RadAjaxManager" runat="server" UpdatePanelsRenderMode="Inline">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadAjaxManager">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadComboBox" />
<telerik:AjaxUpdatedControl ControlID="RadGrid" />
</UpdatedControls>
</telerik:AjaxSetting>
...
</AjaxSettings>
</telerik:RadAjaxManager>
If anyone can provide me a credible reason as to why this is, I will gladly mark it as the answer. Otherwise, I hope this prevents frustration for someone else.