Adding Content Backend fields

Posted by Community Admin on 04-Aug-2018 23:24

Adding Content Backend fields

All Replies

Posted by Community Admin on 19-Dec-2011 00:00

Hi,

I have added a new backend field in Content block from using this:

Find Controls > ContentBackend > Views > ContentBackendInsert / ContentBackendEdit > Sections > MainSection > Fields. ContentBackendInsert is the name of the view used to insert content items, while ContentBackendEdit is the view for editing.

Now, I have the field added in the backend to be inserted into the database also. I found a code snippet:

App.WorkWith()
               .DynamicData()
               .Type(typeof(Telerik.Sitefinity.GenericContent.Model.ContentItem))
               .Field()
                    .TryCreateNew("BranchName", typeof(string))
                    .SaveChanges(true);

I want this code to be written on the SaveChanges event of 'CreateNewContentBlock'.
Where can i get this event in the code behind.

Thanks & Regards,
Gagandeep




Posted by Community Admin on 22-Dec-2011 00:00

Hello,

 
This task is achievable with External Scripts. This is a relevant thread: http://www.sitefinity.com/devnet/forums/sitefinity-4-x/general-discussions/how-to-implement-moving-of-items-up-and-down.aspx 

You can create a service that executes your code snippet and an external script for the ContentBackendInsert view that makes the service call.

You can register your script through Administration -> Settings -> Advanced -> Content -> Controls -> ContentBackend -> Views -> ContentBackendInsert -> Scripts.

The event you need is onSaved  ( this._binder.add_onSaved([your method here]) ).

Greetings,
Boyko Karadzhov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed