How to disable javascript for RAD Controls

2 posts, 0 answers
  1. Manoj
    Manoj avatar
    11 posts
    Member since:
    Jul 2010

    Posted 09 Nov 2010 Link to this post

    Hi,

    We have a requirement to render a page in edit mode and read only mode.

    The RAD controls that we are using are custom classes that inherits from Rad control classes. For example we have a class called CSRadComboBox that extends from the class RadComboBox and we use the instances of class CSRadComboBox in all the code for the project.

    When a page is rendered in the read-only mode to the users, we override the Render method of the RadComboBox and render an System.Web.UI.WebControls.Label object with the contents in it. I have copy pasted the code used to render in the readonly mode for one of the controls below.
    protected override void Render(HtmlTextWriter writer)
    {
        if (IsReadOnly)
        {
            Label lblValue = new Label();
            string display = "--";
            if (!string.IsNullOrEmpty(this.SelectedText))
            {
                display = this.SelectedText;
            }
            lblValue.Text = display;
            lblValue.RenderControl(writer);
        }
        else
        {
            base.Render(writer);
        }
    }


    We have a problem in the readonly pages that there are lot of javascript error that is thrown, "null is null or not an object" and when debugged in visual studio, we could make out that the ajax javascript from the telerik resource is trying to attach events to the labels that has been entered and since it is not able to find the actual control, the javascript error is being thrown.

    We need help on how to disable javascript for individual rad controls in the readonly view of the page when actually it is not required at all.

    Thanks,
    Manoj

  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 11 Nov 2010 Link to this post

    Hello Manoj,

    Please, try setting EnableEmbeddedScripts="false" for the controls that you need to disable loading their javascript files.


    All the best,
    Peter
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top