Copied to clipboard

Flag this post as spam?

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


  • João Pereira 41 posts 64 karma points
    Oct 20, 2010 @ 23:14
    João Pereira
    0

    Save member in Admin UI clears all properties values

    Hi there,

     

    I created custom usercontrols (ascx) and added them as DataTypes so I could use them as propertys in the Member Profile.

    Everything works fine when the user registers or edits his profile in the page I built for that purpose, but when I save their profile in the Admin UI, when trying to add a new role to a specific user, all the profile properties are overwritten with empty values.

    The controls are simply, except for one that uploads a photo using ajax without postback, but that's not the problem.

     

    I really need the ability to add and remove roles to users, without deleting their profile properies...

    I'm I doing something wrong?

     

    Here's the code for one of the DataTypes I created. It's a dropdownlist that shows a textbox when the user selects the Other option. You can imagine the ascx... :)

    
    

            public string umbracoValue;

     

            protected void Page_Load(object sender, EventArgs e)

            {

                if (Page.IsPostBack)

                {

                    if (!String.IsNullOrEmpty(ddlOption.SelectedValue))

                    {

                        umbracoValue = ddlCountry.SelectedValue;

                        if (ddlOption.SelectedValue == "Outro")

                            umbracoValue += "%" + txtOther.Text;

                    }

                }        

            }

     

            public object value

            {

                get { return umbracoValue; }

                set

                {

                    if (value != null)

                    {

                        string[] val = value.ToString().Split('%');

                        if (val.Length > 1)

                        {

                            umbracoValue = value.ToString();

                            ddlOption.SelectedValue = val[0];

                            txtOther.Text = val[1];

                            divOther.Style.Remove("display");

                        }

                        else

                        {

                            umbracoValue = value.ToString();

                            ddlOption.SelectedValue = value.ToString();

                        }

                    }

                    else { umbracoValue = String.Empty; }

                }

            }

     

  • 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