Copied to clipboard

Flag this post as spam?

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


  • Gary Stevens 4 posts 24 karma points
    Sep 02, 2010 @ 20:35
    Gary Stevens
    0

    Custom Data Type crashing on save and publish

    Hi there

    I am in the process of creating a custom data type which allows the user to select multiple items from a list box which is stored as a comma delimited list when saved. The bulk of the work is done with Javascript which saves the Node Id's into a hidden input. The hidden input will then be stored as the value.

    It's still in development so at the moment I only have the .ascx file running, the .ascx.cs isn't doing anything except returning a blank value and populating one of the list boxes. My problem is that when I click save and publish it grinds to a halt, taking ages then eventually causes a 503 error. Document Types not using this Data Type save normally and quickly.

    As the .ascx file is rendering ok I assumed the problem is something to do with the .cs (code below). I am running Umbraco 4.5 on .Net 3.5 and using the UmbracoTv.DataEditors.UCWrap to create the data type.

    namespace UmbracoTv.DataEditors.UCWrap
    {
        public partial class MulitSelect : System.Web.UI.UserControl,
            umbraco.editorControls.userControlGrapper.IUsercontrolDataEditor
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!Page.IsPostBack)
                {
                    Node performers;
                    performers = new umbraco.presentation.nodeFactory.Node(1075);

                    foreach (Node performer in performers.Children)
                    {
                        list_all_performers.Items.Add(new ListItem(performer.Name.ToString(), performer.Id.ToString()));
                    }
                }

                lit_list_all_performers.Text = list_all_performers.ClientID.ToString();
                lit_list_for_new_performers.Text = list_new_performers.ClientID.ToString();
                lit_artists.Text = testText.ClientID.ToString();
            }

            #region IUsercontrolDataEditor Members

            public object value
            {
                get
                {
                    return value;
                }
                set
                {

                }
            }

            #endregion
        }

    Has anyone else experienced a problem with custom data types causing this sort of slow down? any help would be greatly appreciated.

     

    Gary Stevens 

     

  • Sascha Wolter 615 posts 1101 karma points
    Sep 10, 2010 @ 00:19
    Sascha Wolter
    0

    Hi Gary,

    not sure if this is relevant anymore or you figured it out already. Haven't encountered anything like that yet. However it might be because the value never gets initialized or set properly. Here is the code of a custom datatype I have implemented on a recent project:

            private string umbracoValue;

            public object value
            {
                get
                {
                    return umbracoValue;
                }
                set
                {
                    umbracoValue = value.ToString();
                }
            }

            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    Session["filmFile"] = umbracoValue;                  //comment this out, not needed just to get it work

                    SetFlowPlayerVideo();                                       //comment this out
                }
                else
                {
                    umbracoValue = Session["filmFile"].ToString();           //populate with something else, e.g. 'test', just so that it has a value.
                }

            }

    Hope that helps,

    Sascha

  • Gary Stevens 4 posts 24 karma points
    Sep 21, 2010 @ 10:04
    Gary Stevens
    0

    Hi Sascha

    Thank you very much for your help on this. This has stopped it crashing and given me something to start building on, which is fantastic. Thanks for your help. Sorry for taking so long to get back to you.

     

    Many thanks

    Gary Stevens

  • Sascha Wolter 615 posts 1101 karma points
    Sep 21, 2010 @ 11:09
    Sascha Wolter
    0

    Great stuff, glad I could be of help. :)

Please Sign in or register to post replies

Write your reply to:

Draft