| <%@ 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> |
| <%@ 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"; |
| } |
| } |
| } |
| <%@ 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?
This is where the AjaxSetting is added in the Page_Load of my User Control, If i comment this out the ajax of the outer containing panel handles the ajax call and everything is fine, but this is added in the page not the user control?
|
Dim oAjaxManager As Telerik.Web.UI.RadAjaxManager
oAjaxManager = RadAjaxManager.GetCurrent(Page)
Dim oAjaxLoadingBar As Telerik.Web.UI.RadAjaxLoadingPanel
oAjaxLoadingBar = Page.FindControl( "AjaxLoadingBar")
If Not IsNothing(oFriendlyURL) And Not IsNothing(oFriendlyURLError) Then |
| oAjaxManager.AjaxSettings.AddAjaxSetting(oFriendlyURL, oFriendlyURL, Nothing) |
| oAjaxManager.AjaxSettings.AddAjaxSetting(oFriendlyURL, oFriendlyURLError, oAjaxLoadingBar) |
| End If |
I think this behavior is a bug. Try to do the same to replicate it.
| <telerik:RadGrid ID="RadGrid1" runat="server" |
| onneeddatasource="RadGrid1_NeedDataSource" |
| Skin="Office2007" AllowFilteringByColumn="True" AllowPaging="True" |
| AllowCustomPaging="True" VirtualItemCount="10000" |
| AllowSorting="True" GridLines="None" oncolumncreated="RadGrid1_ColumnCreated" |
| ShowFooter="True" onsortcommand="RadGrid1_SortCommand" |
| onitemdatabound="RadGrid1_ItemDataBound" |
| onitemcommand="RadGrid1_ItemCommand" EnableLinqExpressions="false"> |
| <HeaderContextMenu Skin="Office2007" EnableTheming="True"> |
| <ExpandAnimation Type="None" Duration="0" /> |
| <CollapseAnimation Type="None" Duration="0" /> |
| </HeaderContextMenu> |
| <PagerStyle Mode="NextPrevNumericAndAdvanced" /> |
| <MasterTableView EnableHeaderContextMenu="true" AllowMultiColumnSorting="True" AllowCustomSorting="true" ClientDataKeyNames="n_id,n_code_name,n_nug_typ_id" > |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| </MasterTableView> |
| <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True" AllowRowsDragDrop="true" EnableRowHoverStyle="true" > |
| <Selecting AllowRowSelect="True" /><ClientEvents OnRowDblClick="RowDblClick" /> |
| <Scrolling AllowScroll="True" UseStaticHeaders="True" /> |
| <Resizing AllowRowResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True" AllowColumnResize="True"></Resizing> |
| </ClientSettings> |
| <FilterMenu Skin="Office2007" EnableTheming="True"> |
| <ExpandAnimation Type="None" Duration="0" /> |
| <CollapseAnimation Type="None" Duration="0" /> |
| </FilterMenu> |
| </telerik:RadGrid> |
| protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e) |
| { |
| int dbAttributesCount, i, j; |
| DataTable dtMetadata; |
| // zÃskánà dat |
| this.ReadQueryAndRun(); |
| dbAttributesCount = this.dsTranslatedAttributes.Tables[0].Rows.Count; |
| dtMetadata = this.dsTranslatedAttributes.Tables[0]; |
| DataColumn dataColumn; |
| i = 0; |
| while (i < this.dsData.Tables[0].Columns.Count) |
| { |
| dataColumn = this.dsData.Tables[0].Columns[i]; |
| for (j = 0; j < dbAttributesCount; j++) |
| { |
| if (dataColumn.ColumnName == (string)dtMetadata.Rows[j]["code_name"]) |
| break; |
| } |
| if ((j == dbAttributesCount) && (this.dsData.Tables[0].Columns[i].ColumnName != "renderStatus")) |
| this.dsData.Tables[0].Columns.Remove(dataColumn); |
| else |
| i++; |
| } |
| thisthis.RadGrid1.DataSource = this.dsData.Tables[0]; |
| } |
| protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e) |
| { |
| // zkusà se dohledat překládaná popiska sloupce |
| DataRow[] foundRows; |
| XmlNode xnColumn; |
| string columnUniqueName; |
| columnUniqueName = e.Column.UniqueName; |
| if (columnUniqueName != "ExpandColumn") |
| { |
| // nastavenà překládaného záhlavà sloupce |
| if (this.dsTranslatedAttributes != null) |
| { |
| foundRows = this.dsTranslatedAttributes.Tables[0].Select("code_name = '" + columnUniqueName + "'"); |
| if (foundRows.Length > 0) |
| { |
| e.Column.HeaderText = (string)foundRows[0]["name"]; |
| } |
| // skrytà sloupce, který nenà třeba ukazovat |
| if (columnUniqueName == "renderStatus") |
| e.Column.Visible = false; |
| // nastavenà viditelnosti jednotlivých sloupců dle definice v dotazu |
| e.Column.Display = false; |
| if (columnUniqueName != null && columnUniqueName != "") |
| { |
| xnColumn = this.xdQuery.SelectSingleNode("//list/grid[@type='nuggets']/columns/col[@name='" + columnUniqueName + "']"); |
| if (xnColumn != null) |
| { |
| // nastavenà viditelnosti jednotlivých sloupců dle definice v dotazu |
| if (xnColumn.Attributes["state"] != null && xnColumn.Attributes["state"].Value == "1") |
| e.Column.Display = true; |
| else |
| e.Column.Display = false; |
| } |
| } |
| } |
| } |
| } |
| protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| GridDataItem dataItem; |
| long nuggetId; |
| string attCodeName; |
| if (this.gnl.containsNuggetsWithAPActivated) |
| { |
| if (e.Item is GridDataItem) |
| { |
| dataItem = (GridDataItem)e.Item; |
| nuggetId = long.Parse(dataItem["n_id"].Text); |
| this.gnl.alNuggetsWithAPActivated.Contains(nuggetId.ToString()); |
| { |
| // všechna metadata musà být dohledána v dsCheckedAttributes, jinak je nutné je vyeliminovat |
| int attributeCount = this.dsTranslatedAttributes.Tables[0].Rows.Count; |
| for (int i = 0; i < attributeCount; i++) |
| { |
| // některé atributy jsou viditelné vždy |
| attCodeName = (string)this.dsTranslatedAttributes.Tables[0].Rows[i]["code_name"]; |
| if (attCodeName != "n_id" && attCodeName != "n_nug_typ_id" && attCodeName != "renderStatus") |
| { |
| if (!(this.dsCheckedAttributes.Tables[0].Select("id = " + nuggetId.ToString() + " and code_name='" + attCodeName + "'").Length > 0)) |
| { |
| if (dataItem[attCodeName] != null) |
| dataItem[attCodeName].Text = "~RR~"; |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| if (gnp.sortedColumn != null) |
| { |
| se = new GridSortExpression(); |
| se.FieldName = gnp.sortedColumn; |
| if (gnp.sortedOrder == "asc") |
| se.SortOrder = GridSortOrder.Ascending; |
| else |
| se.SortOrder = GridSortOrder.Descending; |
| this.RadGrid1.MasterTableView.SortExpressions.Add(se); |
| } |
| <script type="text/javascript"> |
| function OnClientLoad(editor, args) |
| { |
| var style = editor.get_contentArea().style; |
| style.backgroundImage = "none"; |
| style.backgroundColor = "white"; |
| } |
| </script> |