Copied to clipboard

Flag this post as spam?

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


  • matthew 6 posts 26 karma points
    Jan 16, 2012 @ 12:21
    matthew
    0

    Replacing Custom Repeater Content Control

    I am building a custom content repeat control as existing one has bugs.

     

    Basically the existing control saved data to cmsContentXml in xml format and various other tables. At the moment I am unsure of all the tables where all the data is getting stored for the existing control. A lot is going on under the hood I can’t see as the code is compiled.

     

    Was wondering if you had any recommendations in terms of finding out where the existing data was saved/ whether there was something umbraco related that ties in saving the data to the correct places /or whether it would be best to create a new table and save the data to this.

     

     This would mean I rewrite on the front end to bring back the data.

     

    Need to know if there is something build into umbraco for saving the data in the correct places for a new control in the custom database or whether it is best to save the data to a new table. Deciphering the tbale structure and xml and trying to recreate this is a tricky job, unless there is something built into umbraco or a good resource online.

     

    Any help most appreciated.

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Jan 23, 2012 @ 16:32
    Tim
    0

    Which control are you using? If you're using this one:  http://our.umbraco.org/projects/backoffice-extensions/repeatable-custom-content don't bother, it doesn't work very well in newer versions of Umbraco, and hasn't been updated in a long time (last update was 2009). For repeating content, I'd normally use: http://our.umbraco.org/projects/backoffice-extensions/embedded-content. That control also has it's source available to download here: https://bitbucket.org/TheFarm/embedded-content-umbraco making it much easier to make any changes you need, as well as see how it works.

    If you don't have access to the source of a component, I'd recommend using something like Reflector to decopile it and have a look at what the code is doing, it can be very helpful!

    If you want to know more about building DataTypes for Umbraco, there are some useful tutorials on the web, although some are slightly out of date now. There are also a number of useful videos on te umbraco video site (note a subscription is required for most of the videos here): http://umbraco.com/help-and-support/video-tutorials/developing-with-umbraco/data-editors.aspx

    Hope that helps!

    :)

  • matthew 6 posts 26 karma points
    Jan 25, 2012 @ 16:17
    matthew
    0

    thanks for your reply

    I dropped the previous control. Howver implementing this control requires the latest umbraco. I tried upgrading umbraco but xml is different structure and it seems to be breaking all over the show. I am creating a custom control. Which tables do i need to save the data to if i am going to save into the umbgraco format at present.

    Can't seem to find an article that says- I have a custom user control in a template- when the user presses save i want this data to save to ..............

     

    More details below also:

    Basically I have created a user control, wrapped it in a custom data wrapper and used it as a data type on a cms template page where there are other tabs.

    Now I can Save the data from this control to my own table. However I need to save data for this control in the umbraco way. So for example

    I have a property page.

    A property page has a images tab, an about us tab. All thede controls are ones in umbraco. Now I add my control, features control. Int he code behind for the user control where should i save the data too. When a user clicks saves at present umbraco does the save for say a text box which was a prebuild field.

     

    Which tables do i need to save to- is sql the best way of doing this. Where do i need to save xml.

     

    I need a decent article explaining where to save data and how to save data in the umbraco database. So for example my property feautures which tables do i save them to.

     

     

     

     

     

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Jan 25, 2012 @ 16:46
    Tim
    1

    Hiya,

    If you set up the user control correctly, Umbraco will save the data into its tables through the API. ITs not generally recommended that you save the data in your own tables if you want the data to appear in the umbraco XML cache. The API does a lot of additional work when you save to it, like updating the Lucene indexes and the XML cache that won't happen if you save the data to the database directly. If you're going to access your custom data from the database on the front end, then you could get away with storing the data in separate tables, but for most stuff you should be able to just use the built in stuff.

    Check out Tim G's blog http://www.nibble.be for posts on DataType Editors, that should be of some use. For using user controls, your user control should have a public property called "value" that can be of type string or object. Whatever is returned by that property will be saved by Umbraco to its database. Tim's blog has examples of saving data as XML if you want to store complex data in the field.

    Ifyou want to see some decent examples of custom DataTypes that save data through the API, I highly recommend downloading the source for uComponents from http://ucomponents.codeplex.com the project has dozens of DataTypes in it that you can look at and figure stuff out from. It helped me loads when I came to write my own custom DataTypes.

    Hope that helps!

Please Sign in or register to post replies

Write your reply to:

Draft