Dear Telerik Team,
First, I would like to point out that the support job you do all over the year is great, and I think that plenty of developpers are really thankfull but don't say it (enough). Your job is really helpfull for us poor developpers trying to use your controls.
This said, let's process my problem :)
I have something really similar to the following code. I would like to change the title of the RadWindow "FollowUpDialog" from FollowUp.aspx. I would like to do this depeding on a server-side checked condition.
Software.aspx
Software.aspx.cs
FollowUp.aspx
FollowUp.aspx.cs
First, I would like to point out that the support job you do all over the year is great, and I think that plenty of developpers are really thankfull but don't say it (enough). Your job is really helpfull for us poor developpers trying to use your controls.
This said, let's process my problem :)
I have something really similar to the following code. I would like to change the title of the RadWindow "FollowUpDialog" from FollowUp.aspx. I would like to do this depeding on a server-side checked condition.
Software.aspx
<%@ Page Language="C#" MasterPageFile="~/Pages/Master/MasterPage.master" AutoEventWireup="true" CodeFile="Software.aspx.cs" Inherits="Pages_Projects_Software" Title="Software" %><asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server"></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"> <telerik:RadScriptBlock ID="RadCodeBlock1" runat="server"> <script type="text/javascript"> function ShowFolloUpForm(id) { window.radopen("FollowUp.aspx?IdProject=" + id, "FollowUpDialog"); return false; } </script> </telerik:RadScriptBlock> <telerik:RadAjaxManager ID="RessourceManager" runat="server" OnAjaxRequest="RessourceManager_AjaxRequest"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RessourceManager"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGridSoftware" LoadingPanelID="RadAjaxLoadingPanel1" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="RadGridSoftware"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGridSoftware" LoadingPanelID="RadAjaxLoadingPanel1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadWindowManager ID="RadWindowManagerSoftware" runat="server" EnableEmbeddedSkins="false"> <Windows> <telerik:RadWindow ID="EditSoftware" runat="server" Title="" Height="500px" Width="650px" Left="150px" ReloadOnShow="true" ShowContentDuringLoad="false" Behaviors="None" Modal="true" VisibleStatusbar="false" /> <telerik:RadWindow ID="FollowUpDialog" runat="server" Title="THIS IS A BAD TITLE" Height="300px" Width="500px" Left="150px" ReloadOnShow="true" ShowContentDuringLoad="false" Behaviors="None" Modal="true" VisibleStatusbar="false" /> </Windows> </telerik:RadWindowManager> <fieldset> <legend>Liste des Softwares</legend> <telerik:RadGrid ID="RadGridSoftware" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSourceSoftware" GridLines="None" ShowFooter="True" AllowSorting="True" EnableLinqExpressions="False" OnItemCreated="RadGridSoftware_ItemCreated" OnItemCommand="RadGridSoftware_ItemCommand" EnableEmbeddedSkins="false"> <MasterTableView DataKeyNames="IdSoftware" DataSourceID="SqlDataSourceSoftware" ShowHeader="true" AutoGenerateColumns="False" AllowPaging="true" NoMasterRecordsText="Pas de Software" HierarchyLoadMode="ServerOnDemand" CommandItemDisplay="Top" Name="Master"> <CommandItemTemplate> <a href="#" onclick="return ShowSoftwareInsertForm();"> <img alt="add" src="../../Images/add.gif" />Ajouter un Software</a> </CommandItemTemplate> [... NestedViewTemplate with another RadGrid on it but it's not important ...] <ExpandCollapseColumn Visible="True"> </ExpandCollapseColumn> <Columns> <telerik:GridTemplateColumn UniqueName="pTemplateFollowUpColumn"> <ItemStyle Width="20px" /> <ItemTemplate> <asp:ImageButton ID="btnFollowUp" CssClass="cmdCursor" runat="server" ImageUrl="~/Images/note_accept.gif" AlternateText='Follow Up / View Follow Up' Text="Follow Up" /> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView> </telerik:RadGrid> </fieldset> <asp:SqlDataSource ID="SqlDataSourceSoftware" runat="server" ConnectionString="..." SelectCommand="LIST_Software" SelectCommandType="StoredProcedure"> </asp:SqlDataSource> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" EnableEmbeddedSkins="false"> </telerik:RadAjaxLoadingPanel></asp:Content>Software.aspx.cs
using System;using System.Collections.Generic;using System.Configuration;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using Telerik.Web.UI;public partial class Pages_Projects_Software : Page{ #region Private et Public Properties, Enum et Constantes /// <summary> /// Gets or sets the id Project. /// </summary> /// <value>The id Project.</value> protected Int32 IdProject { get; set; } #endregion #region Cycle de vie et Evenements /// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { } /// <summary> /// Handles the ItemDataBound event of the RadGridProjectNested control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Telerik.Web.UI.GridItemEventArgs"/> instance containing the event data.</param> protected void RadGridProjectNested_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem) e.Item; IdProject = (int)item.OwnerTableView.DataKeyValues[item.ItemIndex]["IdProject"]; ImageButton FollowUp = (ImageButton)item.FindControl("btnFollowUp"); FollowUp.Attributes["onclick"] = String.Format("return ShowFollowUpForm('{0}');", IdProject); [...] } } #endregion }FollowUp.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/Pages/Master/MasterPage2.master" AutoEventWireup="true" CodeFile="FollowUp.aspx.cs" Inherits="Pages_Projects_FollowUp" %><asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server"></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"> <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> <script type="text/javascript"> function GetRadWindow() { var oWindow = null; if (window.radWindow) oWindow = window.radWindow; else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; return oWindow; } function CloseWindow() { GetRadWindow().Close(); } </script> </telerik:RadCodeBlock> <p>POC</p> <asp:Button ID="btnClose runat="server" Text="Close the window" OnClientClick="CloseWindow();" /></asp:Content>FollowUp.aspx.cs
using System;using System.Linq;using System.Web.UI.WebControls;using Telerik.Web.UI;/// <summary>/// /// </summary>public partial class Pages_Projects_FollowUp : System.Web.UI.Page{ #region Cycle de vie et Evenements /// <summary> /// Déclenche l'événement <see cref="E:System.Web.UI.Control.Init"/> pour initialiser la page. /// </summary> /// <param name="e"><see cref="T:System.EventArgs"/> qui contient les données d'événement.</param> protected override void OnInit(EventArgs e) { base.OnInit(e); // >>> Let's change the RadWindow title. In my exemple, I check if there is a QueryString particular value. If it's true, then I change the RadWindow Title. // FollowUpDialog.Title = "This is a good title"; } #endregion }