Copied to clipboard

Flag this post as spam?

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


  • gilpt 33 posts 53 karma points
    Jun 06, 2011 @ 17:02
    gilpt
    0

    adding new datatype

    there are 2 ways i can add a custom datatype

    1. usercontrolwrapper

    2. by inheriting abstractDataEditor

    i'm using the second way  (i want to create a datatype that rendered as TextBox) 

    i have a usercontrol that should render as the dataEditor

    when i put  a Textbox, for an inctance, in this usercontrol (directly in the ascx file ) i dont see anything render as a dataeditor of my datatype

    but when i create my TextBox for an inctance  not in the  ascx file  , but in my usercontrol.ascx.cs (in the code behind)

    like this:

    this.Controls.Add(new TextBox ());

    i see the dataEditor of my datatype .

     

    i just want to know whether i cant "put" my control directly in the ascx file , or i'm doing something wrong ..

    where should i put my ascx file ? maybe , i put the ascx file in a wrong location

    (i put it in the usercontrols folder)

     

    hope i made myself clear

     

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jun 06, 2011 @ 17:21
    Tom Fulton
    0

    Hi,

    Yes, you should be able to create the textbox in the ascx file itself.

    Check out this sample with a DropDownList inserted into the ASCX:  http://www.nibble.be/?p=93

    Also here is an older article with a textbox:  http://www.nibble.be/?p=24

    If you can't find anything wrong try posting your code and we'll see if we can help

    Hope this helps,
    Tom

  • gilpt 33 posts 53 karma points
    Jun 06, 2011 @ 23:01
    gilpt
    0

    hi Tom   .. both  samples you gave refers to the option of creating a datatype by implementing the

    umbraco.editorControls.userControlGrapper.IUsercontrolDataEditor   interface...

     

    i'm using the other way , that inherits from abstractDataEditor.

    and i see nothing rendered .. i got a feeling that i put the ascx file in a wrong place ..

    (i put it in the usercontrols folder)

     

    hope i made myself clear

     

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jun 07, 2011 @ 13:26
    Tom Fulton
    0

    Hi,

    Sorry, missed that.  But I'm not sure what you are doing...if you are using the abstract data editor you should not have any .ascx file, just .cs files.  Or are you trying to call the usercontrol from the .cs file?  Perhaps try posting your code that is calling the usercontrol.

    Here is an example of creating an abstract data editor datatype, where the control is contained in it's own class (not a usercontrol but possibly same idea):  http://www.nibble.be/?p=90

    -Tom

  • gilpt 33 posts 53 karma points
    Jun 08, 2011 @ 15:36
    gilpt
    0

    thanks Tom , that is correct  i'm using the abstract data editor and trying to call the usercontrol from the .cs file

    as shown in the example  http://www.nibble.be/?p=90

    but in the example i can see if the usercontrol (CharlimitControl ) is written in .ascx file or in the code behind

     

    do you have anything in mind ?

     

     

     

     

     

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jun 08, 2011 @ 15:40
    Tom Fulton
    0

    If you download the source at the bottom of the article you can see it's written in code behind rather than a usercontrol.

    Are you trying to use the usercontrol as the base.RenderControl?  If so I'm not sure if that will work (haven't tried).  But I do know you can use a custom control as the base.RenderControl, then call a usercontrol from it.  This is done in DAMP - source here:  http://damp.codeplex.com/SourceControl/changeset/view/74901#1765779

Please Sign in or register to post replies

Write your reply to:

Draft