Copied to clipboard

Flag this post as spam?

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


  • Anders Brännmark 226 posts 277 karma points
    May 23, 2011 @ 21:28
    Anders Brännmark
    0

    Getting value from a datatype used in a custom aspx?

    Making a custom dialog in Umbraco where I used Umbraco "datatypes" as controls on the page. The problem I have is getting the value entered in these controls on postback.

    Code for getting a control, retriving the datatype from a doctype as I dont have any "content" item it should belong to:

    DocumentType docType = new DocumentType(####);
    ConfigDataType(docType.getPropertyType("title"), paneTitle)

    private void ConfigDataType(umbraco.cms.businesslogic.propertytype.PropertyType propertyType, Pane pane)
    {
    IDataType dataType = propertyType.DataTypeDefinition.DataType;
    dataType.DataEditor.Editor.ID = string.Format("prop_{0}", propertyType.Alias);
    dataType.Data.PropertyId = propertyType.Id;

    //Add datatype
    _dataTypes.Add(dataType);

    //Add control to the pane för rendering.
    pane.addProperty(propertyType.Name, dataType.DataEditor.Editor);
    }

     

    _dataTypes is a private arraylist. On postback I check the datatypes in the arraylist for its Idata value. I dont have any value in IData before executing the save method on the DataEditor of the datatype. Is it safe to execute the save method on all datatypes to get the value? What is acctually the preferd way? I'm only using the datatypes to mimmic the Umbraco properties from this document, they will never be tied into a specific content node, as they are used for a batch update to many content nodes...

Please Sign in or register to post replies

Write your reply to:

Draft