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 05, 2011 @ 11:55
    gilpt
    0

    i'm trying to create my own datatype

    by inheriting AbstractDataEditor

    umbraco.cms .businesslogic .datatype .

        public class QueryStringDataEditor : umbraco.cms .businesslogic .datatype .AbstractDataEditor

    private QueryStringDataEditorUC

    control;

     properties

    public override Guid

    Id

    get

    {

    return new Guid ("B630F00A-96DA-4969-8FF8-99E233DADAB9"

    );}

     

     

     

    public override string

    DataTypeName

    {

    get

    {

    return "Incredimail QString";}  public QueryStringDataEditor()

    new QueryStringDataEditorUC();

        control =

       base.RenderControl = control; new EventHandler(control_Init);

     

       base.DataEditorControl.OnSave += new    umbraco.cms.businesslogic.datatype.AbstractDataEditorControl.SaveEventHandle(DataEditorControl_OnSave);

    void DataEditorControl_OnSave(EventArgs e)

     

    base.Data.Value = control.QSText; ;}

    void control_Init(object sender, EventArgs e)

     

     

     

    base.Data.Value == null ? "" : base.Data.Value.ToString();}

     

    ====================================================

     

    my DataType uses the UserControl QueryStringDataEditorUC (contain only TEXTBOX)

    when I put the textbox in QuerystringDataEditorUC.ascx  nothing is rendered and is see nothing on the content section when i want to set a data to my new  datatype

     

    but when the textbox is located in QuerystringDataEditorUC.ascx.cs by

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

    the datatype is render and everything is good ...

     

    is that the way it should be implemented.. can't I create my userControl in the .ascx file???

     

    thanks

     

    {control.QSText =

     

    {

    }

     

       control.Init +=

    }

     

    {

     

    {

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jun 05, 2011 @ 17:12
    Jan Skovgaard
    0

    Hi gilpt

    What do you want to achieve with your custom datatype? Maybe you should consider pasting the code into an external site, since the above is very cluttered and hard to read...I think it's unlikely people take the time to read it as it is. Try pasting it on pastebin.com and provide a link to the code on there in here.

    I regards of creating custom datatypes I think you can profit from have a look at these two entries on Tim Geyssens blog: http://www.nibble.be/?p=99 and http://www.nibble.be/?p=101

    Hope this helps a bit.

    /Jan

  • gilpt 33 posts 53 karma points
    Jun 05, 2011 @ 18:44
    gilpt
    0

    all i'm trying to say is that there are 2 ways i can add acustom datatype

    1. usercontrolwrapper

    2. by inheriting abstractDataEditor

    i'm using the second way .

    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 mt 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 ...

     

    hope i made myself clear

     

Please Sign in or register to post replies

Write your reply to:

Draft