Copied to clipboard

Flag this post as spam?

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


  • Nik Wahlberg 639 posts 1237 karma points MVP
    Aug 11, 2010 @ 18:39
    Nik Wahlberg
    0

    IUsercontrolDataEditor - Not Saving value

    Hi All, this is a well-coverd topic and super basic, but I am missing something. I have this custom data type using the userControlGrapper as base. I have done this before a million times over, but for some reason it's not saving the value from my control to the db/cache?

    public partial class Dt_DocumentCategories : System.Web.UI.UserControl, IUsercontrolDataEditor
        {
            public string umbracoValue = "";
            protected void Page_Load(object sender, EventArgs e)
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(Server.MapPath("/App_Data/DocumentCategories.xml"));
    
                if (!Page.IsPostBack)
                {
                    _documentCategories.Items.Add(new ListItem("Select...", ""));
                    foreach (XmlNode nd in doc.DocumentElement.SelectNodes("//categories/add"))
                    {
                        _documentCategories.Items.Add(new ListItem(nd.Attributes["name"].Value, nd.Attributes["name"].Value));
                    }
                }
    
                if (!umbracoValue.Equals(""))
                {
                    _documentCategories.Items.FindByValue(umbracoValue).Selected = true;
                } 
            }
    
            #region IUsercontrolDataEditor Members
    
            object IUsercontrolDataEditor.value
            {
                get
                {
                    return umbracoValue;
                }
                set
                {
                    if (value != null && !String.IsNullOrEmpty(value.ToString()))
                    {
                        umbracoValue = value.ToString();
                    }
                }
            }
    
            #endregion

    I am running 4.5.1 on Win 7/SQL Server 2005. Is this related to 4.5.1, perhaps?

    Thanks for helping - a seemingly - blind man! 

    -- Nik

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Aug 11, 2010 @ 19:02
    Nik Wahlberg
    0

    Like I said, I'm blind...it helps to actually set the umbracoValue to something :) Sorry about the post...

    -- Nik

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies