I have a web page containing a user control which itself contains another user control. The page contains an Ajax Manager and both user controls define their own Ajax Manager Proxies.
The top level user control shows or hides the nested user control based on the value of a combo box. The nested user control also shows or hides a text box based on the value of a combo box. When I select the option in the combo box of the root user control to display the nested user control and then select the value of the combo box in the nested user control to display the text box in the nested user control I get a javascript "'Undifined' is null or not an object" error and I don't know why.
Here's the contents of the page (nothing in the code behind):
Here's the contents of the UserControl1:
Here's the code behind file for the above user control:
Here's the nested user control and code behind:
The top level user control shows or hides the nested user control based on the value of a combo box. The nested user control also shows or hides a text box based on the value of a combo box. When I select the option in the combo box of the root user control to display the nested user control and then select the value of the combo box in the nested user control to display the text box in the nested user control I get a javascript "'Undifined' is null or not an object" error and I don't know why.
Here's the contents of the page (nothing in the code behind):
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %> |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<%@ Register Src="WebUserControl1.ascx" TagName="uc1" TagPrefix="top" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml" > |
<head runat="server"> |
<title>Untitled Page</title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> |
<top:uc1 ID="UserControl1" runat="server" /> |
<telerik:RadAjaxManager ID="DefaultRadAjaxManager" runat="server" /> |
</form> |
</body> |
</html> |
Here's the contents of the UserControl1:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" Inherits="WebApplication1.WebUserControl1" %> |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<%@ Register Src="WebUserControl2.ascx" TagName="uc2" TagPrefix="nested" %> |
This controls visibility of nested user control.<br /> |
<telerik:RadComboBox ID="name" runat="server" AutoPostBack="true" OnSelectedIndexChanged="name_SelectedIndexChanged"> |
<Items> |
<telerik:RadComboBoxItem Text="Hide nested control" Value="1" Selected="true" /> |
<telerik:RadComboBoxItem Text="Show nested control" Value="2" /> |
</Items> |
</telerik:RadComboBox> |
<asp:Panel ID="somePnl" runat="server" style="display:none;"> |
<nested:uc2 ID="UserControl2" runat="server" /> |
</asp:Panel> |
<telerik:RadAjaxManagerProxy ID="uc1Proxy" runat="server"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="name"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="somePnl" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManagerProxy> |
using System; |
using System.Web; |
using Telerik.Web.UI; |
namespace WebApplication1 |
{ |
public partial class WebUserControl1 : System.Web.UI.UserControl |
{ |
protected void name_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) |
{ |
if (name.SelectedValue=="1") |
somePnl.Style["display"] = "none"; |
else |
somePnl.Style["display"] = "block"; |
} |
} |
} |
Here's the nested user control and code behind:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl2.ascx.cs" Inherits="WebApplication1.WebUserControl2" %> |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<br /> |
This controls visibility of text box.<br /> |
<telerik:RadComboBox ID="phoneSelect" runat="server" AutoPostBack="true" onselectedindexchanged="phoneSelect_SelectedIndexChanged"> |
<Items> |
<telerik:RadComboBoxItem Text="Show text box" Value="-1" /> |
<telerik:RadComboBoxItem Text="" Value="" Selected="true" /> |
<telerik:RadComboBoxItem Text="(123)555-1234" Value="(123)555-1234" /> |
</Items> |
</telerik:RadComboBox> |
<asp:Panel ID="phoneNumberPnl" runat="server" style="display:none;"> |
<telerik:RadNumericTextBox ID="phoneNumber" runat="server" |
MaxLength="20" |
Width="160" /> |
</asp:Panel> |
<telerik:RadAjaxManagerProxy ID="uc2Proxy" runat="server"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="phoneSelect"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="phoneNumberPnl" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManagerProxy> |
using System; |
using System.Web; |
using System.Web.UI; |
namespace WebApplication1 |
{ |
public partial class WebUserControl2 : System.Web.UI.UserControl |
{ |
protected void phoneSelect_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e) |
{ |
if (phoneSelect.SelectedValue != "-1") |
phoneNumberPnl.Style["display"] = "none"; |
else |
phoneNumberPnl.Style["display"] = "block"; |
} |
} |
} |
Note that I'm using ASP Panels and setting style attributes to show and hide because the actual app needs all the controls to be actually present on the form.
Am I doing something wrong or is this a bug?