or
Due to programatic circumstances I'm using a radScheduler with a dynamically added resource done like this:
Dim ds As DataSet 'Code to load dataset Dim rt As New Telerik.Web.UI.ResourceType rt.DataSource = ds rt.Name = "Members" rt.ForeignKeyField = "user_id" rt.KeyField = "user_id" rt.TextField = "user_name" rsATSch.ResourceTypes.Add(rt)Now what I'd like to do is to set the value of the resource when Mode = SchedulerFormMode.AdvancedInsert.
I've tried doing a e.Container.FindControl("Members") in the FormCreated event, but it always comes up Nothing.
So my question is, how do I set the value of a dynamically added resource on an AdvancedForm when adding an appointment?
| <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Demo.aspx.cs" Inherits="ClientAdmin.Demo" %> |
| <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> |
| <!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></title> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <div> |
| <telerik:RadScriptManager ID="RadScriptManager1" Runat="server"> |
| </telerik:RadScriptManager> |
| <telerik:RadToolBar ID="RadToolBar1" Runat="server"> |
| <Items> |
| <telerik:RadToolBarButton Text="Save" Value="Save" CommandName="Save"></telerik:RadToolBarButton> |
| <telerik:RadToolBarButton Text="Edit" Value="Edit" CommandName="Edit"></telerik:RadToolBarButton> |
| </Items> |
| </telerik:RadToolBar> |
| <telerik:RadToolTipManager ID="RadToolTipManager1" runat="server" |
| Animation="Fade" Height="50px" onajaxupdate="RadToolTipManager1_AjaxUpdate" |
| RelativeTo="BrowserWindow" Position="BottomRight" ShowCallout="false" VisibleOnPageLoad="True" Width="50px"> |
| </telerik:RadToolTipManager> |
| </div> |
| </form> |
| </body> |
| </html> |
| using System; |
| using System.Collections.Generic; |
| using System.Linq; |
| using System.Web; |
| using System.Web.UI; |
| using System.Web.UI.WebControls; |
| using Telerik.Web.UI; |
| namespace ClientAdmin |
| { |
| public partial class Demo : System.Web.UI.Page |
| { |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| foreach (RadToolBarItem item in RadToolBar1.Items) |
| { |
| if (item is RadToolBarButton) |
| { |
| RadToolBarButton button = item as RadToolBarButton; |
| RadToolTipManager1.TargetControls.Add(button.ClientID, button.Value, true); |
| } |
| } |
| } |
| protected void RadToolTipManager1_AjaxUpdate(object sender, ToolTipUpdateEventArgs e) |
| { |
| } |
| } |
| } |
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Test.Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> <%@ Register Src="RadWindowTest.ascx" TagName="RadWindowTest" TagPrefix="custom" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <ajaxToolkit:ToolkitScriptManager ID="ScriptManager1" runat="server"> </ajaxToolkit:ToolkitScriptManager> <asp:UpdatePanel ID="upd" runat="server"> <ContentTemplate> <custom:RadWindowTest ID="rwt" runat="server" /> <br /> <asp:Label ID="dummyLabel" runat="server"></asp:Label> </ContentTemplate> </asp:UpdatePanel> </form> </body> </html> <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RadWindowTest.ascx.cs" Inherits="Test.RadWindowTest" %> <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> <style type="text/css"> .hidebutton { visibility: hidden; } </style> <a href="#" id="aOpenWindow" runat="server" onclick="openWin(); return false;">Open Window</a> <telerik:RadWindow ID="RadWindow1" runat="server" Modal="True" Width="1000px" Height="600px" AutoSize="false" Skin="Office2007" Animation="None" Behaviors="Move,Close" KeepInScreenBounds="true" ReloadOnShow="false" VisibleStatusbar="False" VisibleTitlebar="True"> <ContentTemplate> <asp:UpdatePanel runat="server" ID="updatepanel"> <ContentTemplate> <br /> <asp:DropDownList ID="DropDown1" runat="server" Width="400px" AutoPostBack="true" OnSelectedIndexChanged="DropDown1_SelectedIndexChanged"> <asp:ListItem Text="File 1" Value="1"></asp:ListItem> <asp:ListItem Text="File 2" Value="2"></asp:ListItem> <asp:ListItem Text="File 3" Value="3"></asp:ListItem> </asp:DropDownList> <asp:DropDownList ID="DropDown2" runat="server" Width="400px" Visible="false" onChange="showLoadButton()"> <asp:ListItem Text="A" Value="A"></asp:ListItem> <asp:ListItem Text="B" Value="B"></asp:ListItem> <asp:ListItem Text="C" Value="C"></asp:ListItem> </asp:DropDownList> <asp:Button ID="LoadData" runat="server" Text="Load" OnClick="LoadData_Click" CssClass="hidebutton" /> <asp:HiddenField ID="hdn" runat="server" Value="" /> </ContentTemplate> </asp:UpdatePanel> <asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="updatepanel" runat="server"> <ProgressTemplate> <asp:Panel ID="Panel1" CssClass="overlay" runat="server"> <asp:Panel ID="Panel2" CssClass="loader" runat="server"> <img alt="Loading..." src="/images/ajax-loader.gif" /> </asp:Panel> </asp:Panel> </ProgressTemplate> </asp:UpdateProgress> </ContentTemplate> </telerik:RadWindow> <script language="javascript" type="text/javascript"> if (window.addEventListener) // W3C standard { window.addEventListener('load', load, false); } else if (window.attachEvent) // Microsoft { window.attachEvent('onload', load); } function CloseWindow() { var oWindow = $find("<%= RadWindow1.ClientID %>"); oWindow.Close(); } function showLoadButton() { oLoadButton = document.getElementById('<%=LoadData.ClientID %>'); oLoadButton.style.visibility = "visible"; } function openWin() { var oWnd = GetRadWindow(); oWnd.show(); } function GetRadWindow() { var oWindow = $find("<%= RadWindow1.ClientID %>"); return oWindow; } function EndRequestHandler() { var hdn = document.getElementById('<%= hdn.ClientID %>'); if (hdn.value == "1") { var t = setTimeout("CloseWindow()", 100); hdn.value = ""; } } function load() { Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); } </script> using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace Test { public partial class RadWindowTest : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { } protected void DropDown1_SelectedIndexChanged(object sender, EventArgs e) { DropDownList DropDown2 = (DropDownList)RadWindow1.ContentContainer.FindControl("DropDown2"); DropDown2.Visible = true; } protected void LoadData_Click(object sender, EventArgs e) { RadWindow1.DestroyOnClose = true; HiddenField hdn = (HiddenField)RadWindow1.ContentContainer.FindControl("hdn"); hdn.Value = "1"; } } }