Why do get an error that some property is not writable in Ajax... RRS feed

  • Question

  • I have an Ajax control and i am trying to set component property to one of my plain vanilla userControl. This is how i am doing:
    descriptor.AddComponentProperty("myUserControl", myUserControl.ClientID);
    i have myUserControl defined in an "parent control".ascx file defined as
    <uc1 ID="myUserControl" runat="server" />
    The .js file of my (parent which is an Ajax control) has following code to refer to my user control (I have removed unnecessary code from js file in this post).
    MyNameSpace.MyAjaxControl = function(element) {
    MyNameSpace.MyAjaxControl.initializeBase(this, [element]);
    this._myUserControl = null;
    MyNameSpace.MyAjaxControl.prototype = {
      initialize: function() {
        MyNameSpace.MyAjaxControl.callBaseMethod(this, 'initialize');
    dispose: function() {
      this._myUserControl =null;
      MyNameSpace.MyAjaxControl.callBaseMethod(this, 'dispose');
     get_myUserControl: function() {
       return this._myUserControl;
     set_myUserControl: function(value) {
       this._myUserControl = value;
    if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
    when i run my code i get following error.
    Microsoft JScript runtime error: Sys.InvalidOperationException: 'myUserControl' is not a writable property.
    I am totally clueless regarding the cause of this error. Any help is greatly appreciated..
    Thanks a lot in advance CSC
    • Moved by Leo Liu - MSFT Monday, December 12, 2011 5:15 AM Off-Topic (From:JScript for the .NET Framework)
    Wednesday, November 30, 2011 8:52 PM

All replies