Try Now
More in this section

Forums / Developing with Sitefinity / Edit properties of a User Control

Edit properties of a User Control

2 posts, 0 answered
  1. aster
    aster avatar
    12 posts
    08 Dec 2009
    08 Apr 2010
    Link to this post
    I am working on creating a user control which has editable properties. I followed the example shown on this page http://www.sitefinity.com/help/developer-manual/adding-user-controls-implementing-control-designers.html.

    The user control I create is very simple, all it has is a text box that displays the text in a label on a page. When the user control loads and I enter text into the textbox the control runs fine, however, when I try to click on "I am done" or try to edit the user control the second time, I run into this error on "base.LoadControlState(state[0]);" call in the LoadControlState method "Object of type 'System.String[]' cannot be converted to type 'System.String'."

    protected override void LoadControlState(object savedState)
        if (savedState != null)
            object[] state = (object[])savedState;
            this.tempName = (string)state[1];

    Could you please let me know what I am missing?


  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    08 Apr 2010
    Link to this post
    Hi aster,

    The error is telling you that  type-casting error ( Array to String) occured while attempting to set a tempName in your code. I would suggest that you should cast to string fist and the set the value.

    Kind regards,
    Ivan Dimitrov
    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.
2 posts, 0 answered