Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Richard Kingston 46 posts 69 karma points
    Feb 08, 2011 @ 17:53
    Richard Kingston
    0

    Custom Data Type not saving

    Hi all,

    Forgive this post - I'm very VERY new to Umbraco and I'm struggling with a custom web control that isn't saving it's data.

    I've followed the advice here http://forum.umbraco.org/yaf_postst5944_Custom-datatype-usercontrol-wrapper-problem.aspx but to no avail.

    I've created a web control that is simply a text box with a link button alongside it. The text box is set to ReadOnly, but some JQuery attached to link button removes that attribute and enables the field if the currently logged in user is a Adminstrator.

    Everything seems to work fine, apart from the text box value doesn't get saved.

    My code is here:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using umbraco.BusinessLogic;

    namespace UmbracoModules.TextstringAdmin
    {
        public partial class TextstringAdmin : System.Web.UI.UserControl, umbraco.editorControls.userControlGrapper.IUsercontrolDataEditor
        {
            #region Fields

            public string umbracoValue;

            #endregion

            #region Constructors

            protected void Page_Load(object sender, EventArgs e)
            {
                if (Page.IsPostBack)
                {
                    value = txtTextstringAdminField.Text;  
                }
                else
                {
                    txtTextstringAdminField.Text = umbracoValue;
                }
            }

            #endregion

            #region Methods

            private void txtTextstringAdminField_TextChanged(object sender, EventArgs e)
            {
                value = txtTextstringAdminField.Text;
            }

            #endregion

            #region Properties

            public object value
            {

                get
                {

                    return umbracoValue;

                }

                set
                {

                    umbracoValue = value.ToString();

                }

            }

            #endregion
        }
    }

    Can anyone help?

    Thanks

    Rich

  • Chris Randle 67 posts 181 karma points c-trib
    Mar 23, 2012 @ 20:46
    Chris Randle
    0

    I'm going to bump this thread because I am having issues with version 4.7.1 rendering my control, and it appears to save the values in that they stay visible, until you reload the current node and then they go blank.  Anyone resolved this problem?

Please Sign in or register to post replies

Write your reply to:

Draft