Copied to clipboard

Flag this post as spam?

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


  • Kim Grandgagnage 63 posts 87 karma points
    Feb 07, 2011 @ 14:45
    Kim Grandgagnage
    0

    Editing members using a usercontrol

    I've created a custom usercontrol so that members can edit there information in the front-end.

    I have a few issues though. When saving the fields, I get an error saying

    [NullReferenceException: Object reference not set to an instance of an object.]
    umbraco.editorControls.BaseTreePickerEditor.Save() +65
    Kmostarter_MemberCtrls.usercontrols.EditProfiel.UpdateMember_Click(Object sender, EventArgs e) +653
    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +153
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3690

    Is there any information on how to build a proper usercontrol like this page with example code?:
    http://umbraco.org/profile/edit-your-details

    When looping through all the properties of the logged in member I translate each umbraco datatype to a webcontrol like:

    Control propertyfield = df.DataEditor.Editor;
                                        switch (propertyfield.ToString())
                                        {
                                            case "umbraco.editorControls.textfield.TextFieldEditor":
                                                TextBox txtbox = new TextBox();
                                                txtbox.ID = df.DataEditor.Editor.ID;
                                                txtbox.Text = df.Data.Value.ToString();
                                                txtbox.CssClass = "kol-30";
                                                editControls.Controls.Add(txtbox);
                                                lbField.AssociatedControlID = df.DataEditor.Editor.ID;
                                                break;
                                          ...
                                        }

    The problem is that I have a few custom dropdowns in the membertype which is used,  with predefined values. But I don't know how to translate this Umbraco datatype in a proper webcontrol. And how to translate a tinymce editor into a multiline textfield.

    Thanks in advance.

    grts,

    Kim

     

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Feb 07, 2011 @ 14:47
    Ismail Mayat
    0

    Kim take a look at the source of doc2form it will give you some hints http://our.umbraco.org/projects/website-utilities/doc2form

    Regards

    Ismail

Please Sign in or register to post replies

Write your reply to:

Draft