or
$find("<%= AddActiviteWindow.ClientID %>").getWindowBounds(); i get :this is because in _getCurrentBounds you do : var c=(this._popupElement.style.display=="none")?true:false;Uncaught TypeError: Cannot read property 'style' of null Telerik.Web.UI.WebResource.axd:7068a.RadWindow._getCurrentBounds Telerik.Web.UI.WebResource.axd:7068a.RadWindow._getCalculatedPopupBounds Telerik.Web.UI.WebResource.axd:7097a.RadWindow.getWindowBounds Telerik.Web.UI.WebResource.axd:6848reSizeRadeditor
but you don't check if _popupElement exist. In my case because the radwindow is not display, _popupElement is null so i would suggest to add : if (!this._popupElement) return; before this._getCurrentBounds() in the function _getCalculatedPopupBounds
best regards Mathieu
Private button As New RadButton() button.ID = "btnload" button.Text = "load photo" button.Skin = "Office2010Silver" button.Icon.PrimaryIconCssClass = "rbAdd" Dim tip As RadToolTip = New RadToolTip tip.ID = "RadTooltip1" tip.Controls.Add(button) RadAjaxPanel1.Controls.Add(tip) tip.TargetControlID = "Imgprofile" tip.Width = Unit.Pixel(120) tip.Height = Unit.Pixel(30) tip.RelativeTo = ToolTipRelativeDisplay.Element tip.Position = ToolTipPosition.MiddleRight tip.HideEvent = ToolTipHideEvent.ManualClose tip.Show()Dim script As String = "function f(){$find(""" + RadWindowLoadprofile.ClientID + """).show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "key", script, True)<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %><!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> <style type="text/css"> html, body, form { height:100%; margin: 0px; padding: 0px; overflow: hidden; } </style> <asp:ContentPlaceHolder id="head" runat="server" /></head><body> <div style="height:100px; background-color:blue;">Test Master Content</div> <form id="form1" runat="server"> <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" /> <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server" /> </form></body></html><%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <telerik:RadSplitter ID="RadSplitter1" runat="server" Width="100%" Height="100%" Orientation="Horizontal"> <telerik:RadPane ID="RadPane1" runat="server" Width="100%" height="50px" BackColor="Red"> <p>This is a test</p> </telerik:RadPane> <telerik:RadSplitBar ID="RadSplitBar1" runat="server" /> <telerik:RadPane ID="RadPane2" runat="server" Width="100%" Height="100%"> <telerik:RadAjaxManagerProxy ID="AjaxManagerProxy1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadGrid1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManagerProxy> <telerik:RadGrid ID="RadGrid1" runat="server" Width="100%" Height="100%" OnNeedDataSource="RadGrid1_NeedDataSource" /> </telerik:RadPane> </telerik:RadSplitter></asp:Content><telerik:GridTemplateColumn HeaderText="Actions" HeaderStyle-Width="125px" ItemStyle-Width="125px"> <ItemTemplate> <fmh:ActionButton runat="server" CommandArgument='<%# Eval("FieldId") %>' ID="abGridTest" OnMenuItemClicked="abGridTest_OnMenuItemClicked" > <ActionItems>
<fmh:ActionItem Text="Example 1" Icon="save" CommandName="test1" /> <fmh:ActionItem IsSeparator="true" /> <fmh:ActionItem Text="Example 2" Icon="edit" CommandName="test2" /> </ActionItems> </fmh:ActionButton> </ItemTemplate></telerik:GridTemplateColumn>public class ActionItem{ public ActionItem() { Visible = true; } public bool IsSeparator { get; set; } public bool Visible { get; set; } public string CommandName { get; set; } public string Icon { get; set; } public string Text { get; set; }}[ParseChildren(true)]public sealed class ActionButton : DataBoundControl, INamingContainer{ [PersistenceMode(PersistenceMode.InnerProperty)] [TemplateContainer(typeof(ActionButton))] public ITemplate ContentTemplate { get; set; } [Bindable(true), DefaultValue("")] public string CommandArgument { get { object o = ViewState[ClientID + "_CommandArgument"]; return o == null ? "0" : o.ToString(); } set { ViewState[ClientID + "_CommandArgument"] = value; } } [MergableProperty(false), PersistenceMode(PersistenceMode.InnerProperty), DefaultValue((string)null)] public Collection<ActionItem> ActionItems { get; set; } public event CommandEventHandler MenuItemClicked; public RadContextMenu ContextMenu { get; set; } public RadButton Button { get; set; } protected override void CreateChildControls() { base.CreateChildControls(); if (ContentTemplate != null) ContentTemplate.InstantiateIn(this); SetupButtonAndContextMenu(); if (ActionItems != null) { foreach (ActionItem actionItem in ActionItems) { RadMenuItem rmi = new RadMenuItem(); SetupMenuItem(actionItem, rmi); rmi.PostBack = true; rmi.Visible = actionItem.Visible; ContextMenu.Items.Add(rmi); } } Controls.Add(Button); Controls.Add(ContextMenu); } private void ContextMenuOnItemClick(object sender, RadMenuEventArgs radMenuEventArgs) { CommandEventArgs commandEventArgs = new CommandEventArgs(radMenuEventArgs.Item.Attributes["CommandName"], CommandArgument); // This is what I *thought* I would need to do, but this isn't working. Wrong binding flags? //typeof (RadButton).InvokeMember("Click", BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, Button, //new object[] {commandEventArgs});
// This works just fine...because I have a reference to the event already
MenuItemClicked.Invoke(this, new CommandEventArgs(radMenuEventArgs.Item.Attributes["CommandName"], CommandArgument)); } private void SetupButtonAndContextMenu() { Button = new RadButton { ID = "Button", CssClass = "Secondary Utility", EnableSplitButton = true, Text = @"Action", AutoPostBack = false, OnClientClicked = "$F.ActionButton.onClientClicked", EnableEmbeddedSkins = false, Skin = "OurSkin", Width = Width }; Button.Icon.SecondaryIconUrl = "/Common/Images/ButtonIcons/DropDownArrow.png"; ContextMenu = new RadContextMenu { ID = "Button_Menu", ExpandDelay = 0, CollapseDelay = 0, EnableEmbeddedSkins = false, Skin = "OurSkin", OnClientItemClicked = "$F.ActionButton.onClientMenuItemClicked" }; ContextMenu.ItemClick += ContextMenuOnItemClick; } private static void SetupMenuItem(ActionItem actionItem, RadMenuItem rmi) { if (actionItem.IsSeparator) { rmi.IsSeparator = true; return; } if (String.IsNullOrEmpty(actionItem.Text)) { throw new ArgumentNullException("Text", @"ActionItem.Text is a required argument."); } rmi.Text = actionItem.Text; if (!String.IsNullOrEmpty(actionItem.Icon)) rmi.ImageUrl = "/Common/Images/LinkButtonIcons/" + actionItem.Icon + ".png"; rmi.Attributes["CommandName"] = !String.IsNullOrEmpty(actionItem.CommandName) ? actionItem.CommandName : actionItem.Text.RemoveSpaces(); }}$F.ActionButton = { onClientClicked: function (sender, eventArgs) { // Find the context menu and remove animations var contextMenu = window.$find(sender.get_id() + '_Menu'); // Remove the animation so that it shows/hides immediately contextMenu._slide._collapseAnimation.set_type(window.Telerik.Web.UI.AnimationType.None); contextMenu._slide._expandAnimation.set_type(window.Telerik.Web.UI.AnimationType.None); // If it is already visible, just hide it. For some reason the contextMenu.get_visible() returns false, hence the dom check. if (contextMenu.get_contextMenuElement().style.display == 'block') { contextMenu.hide(); return; } // get the position of the Button that was clicked var currentLocation = window.$telerik.getBounds(sender.get_element()); // Calculate position to show the context menu var contextMenuLeft = currentLocation.x; if (contextMenu.get_attributes().getAttribute('RTL') == 't') { var contextMenuWidth = $('#' + contextMenu.get_element().id + '_detached').width(); if (contextMenuWidth == 0) { // reposition off screen so we can calculate the width. Can't do that until it has been rendered once. contextMenu.showAt(-1000, -1000); contextMenuWidth = $('#' + contextMenu.get_element().id + '_detached').width(); } contextMenuLeft = currentLocation.x + currentLocation.width - contextMenuWidth; } var contextMenuTop = currentLocation.y + currentLocation.height; // Show the context menu contextMenu.showAt(contextMenuLeft, contextMenuTop); }, onClientMenuItemClicked: function (sender, eventArgs) { // Is there a function defined? var clientFunction = eventArgs.get_item().get_attributes().getAttribute("ClientFunction"); if (!clientFunction || clientFunction.trim() == '') return; // Is this a real function? var fn = eval(clientFunction); if (!fn) return; // Build arguments to pass including command name and command argument var args = new Object; args.commandName = eventArgs.get_item().get_attributes().getAttribute("CommandName"); args.commandArgument = eventArgs.get_item().get_attributes().getAttribute("CommandArgument"); // Fire off the function passing arguments fn(sender, args); }I have a web part that load user control with the RadScheduler and take a lot time to load the page. Does somebody has any idea why the page take too long?
I did everything in the following documents
Chrome 5 secs
I have expended three days in do everything is in the web.
Regards
HANK