+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Control Designer -- Persist data between tabs.

Control Designer -- Persist data between tabs.

4 posts, 0 answered
  1. Isaac
    Isaac avatar
    63 posts
    Registered:
    01 Dec 2008
    10 May 2011
    Link to this post
    I'm attempting to make a control designer -- everything is going nicely thanks to forum posts and videos on the subject, however I'm having trouble with an issue moving from the 'Basic' tab to the 'Advanced' tab.  If a user updates a property in my 'Basic' tab (the property is just a string exposed through reflection nothing new) and then clicks on the 'Advanced' tab, any information they typed is lost.  How do I persist data between tabs?  I tried using the viewstate for this, but im unsure where to put the calls to store and get.

  2. Isaac
    Isaac avatar
    63 posts
    Registered:
    01 Dec 2008
    11 May 2011
    Link to this post
    Any thoughts? Its mostly from this article : http://www.sitefinitywatch.com/blog/09-02-20/Making_Control_Editing_User-Friendly_with_Sitefinity_Control_Designers.aspx It looks like in the comments a person had a similar problem as mine. Is this not the correct way to make a designer in 3.7 SP4. If so how do I get data changes to 'stick' when switching to the 'advanced' tab.
  3. Isaac
    Isaac avatar
    63 posts
    Registered:
    01 Dec 2008
    12 May 2011
    Link to this post
    Clearly I am doing something wrong. This solution will keep my edits in the textbox, but on the advanced tab there are no updates happening to the Content property -- and as you can see by my choice of variable names, I am lost.

    01.public class GeneralContentControlDesigner : Telerik.Framework.Web.Design.ControlDesigner
    02.{
    03.    private String wrongNess;
    04. 
    05.    public GeneralContentControlDesigner()
    06.    {
    07.        this.Load += new EventHandler(GeneralContentControlDesigner_Load);
    08.        this.PreRender += new EventHandler(GeneralContentControlDesigner_PreRender);
    09.    }
    10. 
    11.    protected void GeneralContentControlDesigner_PreRender(object sender, EventArgs e)
    12.    {
    13.        ContentsTextBox.Text = wrongNess;
    14.    }
    15. 
    16.    protected void GeneralContentControlDesigner_Load(object sender, EventArgs e)
    17.    {
    18.        if (Page.IsPostBack)
    19.        {
    20.            ((GeneralContentControlBase)DesignedControl).Content = wrongNess = ContentsTextBox.Text;
    21.        }
    22.        else
    23.        {
    24.            ContentsTextBox.Text = wrongNess = ((GeneralContentControlBase)DesignedControl).Content;
    25.        }
    26.    }
    27. 
    28.    public override string LayoutTemplatePath
    29.    {
    30.        get
    31.        {
    32.            return "~/UserControls/GeneralContent/GeneralContentDesigner.ascx";
    33.        }
    34.    }
    35.     
    36.    public override void OnSaving()
    37.    {
    38.        ((GeneralContentControlBase)DesignedControl).Content = ContentsTextBox.Text;
    39.    }
    40. 
    41.    protected virtual TextBox ContentsTextBox
    42.    {
    43.        get { return base.Container.GetControl<TextBox>("txtContent", true); }
    44.    }
    45.}
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    13 May 2011
    Link to this post
    Hi Isaac,

    Can you please put a break point on the OnSaving method override and see if the method will be called when you switch modes?

    Greetings,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
4 posts, 0 answered