Copied to clipboard

Flag this post as spam?

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


  • Ron Brouwer 273 posts 768 karma points
    Jul 20, 2009 @ 15:06
    Ron Brouwer
    0

    Attaching OnChange or AutoPostBack to a Contentpicker

    Hi,

    I'm creating a datatype that uses a contentpicker.

    <%@ Register TagPrefix="umb" Namespace="umbraco.controls" Assembly="umbraco" %>
    <umb:ContentPicker ID="cpMyContent"  runat="server"></umb:ContentPicker>

    What I need is to add an OnChange event or at least an AutoPostBack to change the contents of some related fields.

    Any help is much appreciated.

    Ron

  • Ron Brouwer 273 posts 768 karma points
    Jul 20, 2009 @ 18:34
    Ron Brouwer
    0

    Anyone?

  • Simon Justesen 436 posts 203 karma points
    Jul 20, 2009 @ 21:26
    Simon Justesen
    0

    I'm listening :) I've done something similar in the past with the Mediapicker. I had to implement it into a datagrid and adjusted the mediapicker source accordingly. But it was quite an ugly hack, so it's not recommendable. I hope there are better ways of integrating existing controls into new ones like you're trying to archive.

  • Ron Brouwer 273 posts 768 karma points
    Jul 21, 2009 @ 08:40
    Ron Brouwer
    0

    Any help woul be much appriciated, so if you could point me into the right direction.
    Doe anybody know who created the contentpicker?

    Ron

  • Ron Brouwer 273 posts 768 karma points
    Jul 21, 2009 @ 11:00
    Ron Brouwer
    0

    There must be someone..

  • Martijn Beumers 13 posts 172 karma points
    Jul 21, 2009 @ 11:36
    Martijn Beumers
    0

    Nope, this problem is too complex. So it seems :)

  • Jeroen Breuer 4909 posts 12266 karma points MVP 6x admin c-trib
    Jul 21, 2009 @ 11:56
    Jeroen Breuer
    0

    There is a simple workaround. It's not really nice, but you can add an extra button to the datatype and when a new value has been selected in the contentpicker the button can be pressed to update the contents of some related fields. It's not nice but it works.

  • Jeroen Breuer 4909 posts 12266 karma points MVP 6x admin c-trib
    Jul 21, 2009 @ 12:10
    Jeroen Breuer
    0

    Wait I have a better idea. You can copy the contentpicker from the source code and edit it so it can do a postback if you want to. In the source code the file is located at: umbraco/presentation/umbraco/controls/ContenPicker.cs. You should not edit it in the sourcecode but copy it to your own project and edit it there.

  • Ron Brouwer 273 posts 768 karma points
    Jul 21, 2009 @ 15:15
    Ron Brouwer
    1

    Thanks for your input Jeroen,

    I choose a different solution:

    <script type="text/javascript" language="javascript">
                    <%=cpMyContent.ClientID%>_updateContentTitle = function() {__doPostBack("", "")};
                    <%=cpMyContent.ClientID%>_clear = function() {
                            document.getElementById("<%=cpMyContent.ClientID%>").value = "";
                            __doPostBack("", "");
                        } 
    </script>

    I know its a bit dirty but it does the trick.

    Ron

  • 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