EnableExtendedEditor not able to disable

Thread is closed for posting
2 posts, 0 answers
  1. Sathish
    Sathish avatar
    4 posts
    Member since:
    Aug 2012

    Posted 13 Sep 2012 Link to this post

    Hi All,

    iam runing into to some techincal issue,i have telerik text box which is customized and i have EnableExtendedEditor icon control which will open text editor to change the value of textbox but when i disable EnableExtendedEditor it s not working i.e not disabling.

    my code is like below

    <tempo:TextBox runat="server" ID="txtMasterAIName" LabelCssClass="label" ControlCssClass="control" EnableExtendedEditor="true">
                                                <TextBox Width="200px" />
                                                    <Label Text="Name:"></Label>
                                                <Validator CssClass="validation" PropertyName="MASTER_AI_NAME" SourceTypeName="CGI.ESG.TEMPO.ViewEntity.AIMasterView, CGI.ESG.TEMPO.ViewEntity"
                                                    EnableClientScript="true" />
                                            </tempo:TextBox>

    in javascript iam disabling like

     function OnClientSelectedIndexChanged(sender, eventArgs) {
                var item = eventArgs.get_item().get_value();
                var licensePersonCode = sender.get_attributes().getAttribute("LicensePersonCode");
                if (item == licensePersonCode) {
                    var txtMasterAIName = $find('<%= txtMasterAIName.ClientID %>');
                    txtMasterAIName.EnableExtendedEditor = false;
                    launchLicenseeDefinitionWindow();
                    return true;
                }

    but its throwing javascript if i mention txtMasterAIName.EnableExtendedEditor = false; like object null


    below is my custome textbox code
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TempoTextBoxControl.ascx.cs" Inherits="CGI.ESG.TEMPO.Web.CommonControls.TempoTextBoxControl" %>

    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <%@ Register Assembly="CGI.ESG.TEMPO.Web" Namespace="CGI.ESG.TEMPO.Web.UIBase" TagPrefix="tempo" %>

    <asp:Panel ID="pnlLabel" runat="server">
        <span id="lblValidatorFlag" runat="server" class="reqfield">*</span>
        <asp:Label ID="lblText" runat="server" AssociatedControlID="txtData" EnableViewState="false"></asp:Label>
    </asp:Panel>
    <asp:Panel ID="pnlControl" runat="server">
        <telerik:RadTextBox ID="txtData" runat="server">
        </telerik:RadTextBox>
        <tempo:ExtendedEditorPopup ID="edtPopup" runat="server" TextBoxID="txtData" NavigateUrl="~/Pages/AdvancedEditor.aspx"
            OnModalOK="popupExtendedEditor_ModalOK" OnModalShow="popupExtendedEditor_ModalShow" RadWindowID="wndEditor">
        </tempo:ExtendedEditorPopup>
        <tempo:ClientDataAnnotationValidator ID="valData" runat="server" ControlToValidate="txtData" />
    </asp:Panel>


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.ComponentModel;
    using Telerik.Web.UI;
    using CGI.ESG.TEMPO.Web.UIBase;
    using System.Configuration;
    using System.Reflection;
    using CGI.ESG.TEMPO.Common.Aspects;
    using System.Text;
    using System.ComponentModel.DataAnnotations;

    namespace CGI.ESG.TEMPO.Web.CommonControls
    {
        [Themeable(true)]
        public partial class TempoTextBoxControl : TempoCommonUserControl
        {
            #region events
            public event EventHandler TextChanged
            {
                add { txtData.TextChanged += value; }
                remove { txtData.TextChanged -= value; }
            }
            #endregion

            #region properties
            protected override string TooltipDefaultText
            {
                get { return lblText.Text; }
            }

            public bool EnableExtendedEditor
            {
                get { return (bool?) ViewState["extEditor"] ?? true; }
                set { ViewState["extEditor"] = value; }
            }

            [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
            [PersistenceMode(PersistenceMode.InnerProperty)]
            [NotifyParentProperty(true)]
            [Category("Label Settings")]
            public Label Label
            {
                get { return lblText; }
            }

            [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
            [PersistenceMode(PersistenceMode.InnerProperty)]
            [NotifyParentProperty(true)]
            [Category("TextBox Settings")]
            public RadTextBox TextBox
            {
                get { return txtData; }
            }

            [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
            [PersistenceMode(PersistenceMode.InnerProperty)]
            [NotifyParentProperty(true)]
            [Category("Validator Settings")]
            public override ClientDataAnnotationValidator Validator
            {
                get { return valData; }
            }

            public string RequiredFieldIndicatorText
            {
                get { return lblValidatorFlag.InnerText; }
                set { lblValidatorFlag.InnerText = value; }
            }

            #region Label properties
            public string LabelCssClass
            {
                get { return pnlLabel.CssClass; }
                set { pnlLabel.CssClass = value; }
            }
            #endregion

            #region TextBox properties
            public string ControlCssClass
            {
                get { return pnlControl.CssClass; }
                set { pnlControl.CssClass = value; }
            }

            public string Text
            {
                get { return txtData.Text; }
                set { txtData.Text = value; }
            }

            public bool AutoPostBack
            {
                get { return txtData.AutoPostBack; }
                set { txtData.AutoPostBack = value; }
            }
            #endregion
            #endregion

            #region methods
            protected override void Page_Load(object sender, EventArgs e)
            {
                base.Page_Load(sender, e);
            }


            protected override void OnInit(EventArgs e)
            {
                base.OnInit(e);
            }

            public override string ToolTip
            {
                get
                {
                    return txtData.ToolTip;
                }
                set
                {
                    txtData.ToolTip = value;
                }
            }

            public bool ReadOnly
            {
                get { return txtData.ReadOnly; }
                set { txtData.ReadOnly = value; }
            }

            protected void popupExtendedEditor_ModalShow(object sender, ModalOpenEventArgs e)
            {
                URLBuilder builder =new URLBuilder(URLBuilder.ServerBaseUrl() + "Pages/AdvancedEditor.aspx");
                builder["mode"] = this.ReadOnly ? "ro" : "rw";
                if (txtData.MaxLength > 0)
                {
                    builder["len"] = this.txtData.MaxLength;
                }
                builder["title"] = this.lblText.Text.Replace(":","").Replace("*","");
                e.Url = builder.Url;
            }

            protected void popupExtendedEditor_ModalOK(object sender, ModalCloseEventArgs e)
            {
                if (!this.ReadOnly)
                {
                    string newData = e.Result == null ? string.Empty : e.Result as string;
                    if(newData != this.Text)
                    {
                        this.Text = newData;
                        if (this.Page is TempoPage)
                        {
                            TempoPage page = this.Page as TempoPage;
                            page.IsDirty = page.TrackDirty;
                        }
                    }
                }
            }
            #endregion

            protected override void InitializeValidator()
            {
                if (!string.IsNullOrEmpty(valData.SourceTypeName) && !string.IsNullOrEmpty(valData.PropertyName))
                {
                    Type dataType = valData.GetValidatedType();
                    PropertyInfo property = valData.GetValidatedProperty(dataType);
                    object[] stringLengthAttributes = property.GetCustomAttributes(typeof(StringLengthAttribute), true);
                    if (stringLengthAttributes.Length > 0)
                    {
                        StringLengthAttribute attrib = stringLengthAttributes[0] as StringLengthAttribute;
                        if (attrib.MaximumLength > 0)
                        {
                            txtData.MaxLength = attrib.MaximumLength;
                        }
                    }
                    object[] requiredAttribute = property.GetCustomAttributes(typeof(RequiredAttribute), true);
                    if (requiredAttribute.Length > 0)
                    {
                        RequiredValidator = true;
                    }
                    else
                    {
                        RequiredValidator = false;
                    }
                }
                else
                {
                    RequiredValidator = false;
                }
                ValidatorInitialized = true;
                edtPopup.Visible = txtData.MaxLength > 20 && EnableExtendedEditor != false;
            }

            protected override void SetReadOnly()
            {
                txtData.ReadOnly = true;
            }

            protected override System.Web.UI.HtmlControls.HtmlGenericControl RequiredIndicator
            {
                get { return lblValidatorFlag; }
            }
        }
    }

    please help me out to resolve the issue
  2. Antonio Stoilkov
    Admin
    Antonio Stoilkov avatar
    530 posts

    Posted 18 Sep 2012 Link to this post

    Hello Sathish,

    Could you please give more information on your scenario. Where do you use RadControls and how they are related to your issue. You could provide us with step by step instructions on your implementation. Additionally, you could remove all RadControls from the page and observe if the issue still persists.

    All the best,
    Antonio Stoilkov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top