1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Adding Content Backend fields

Adding Content Backend fields

2 posts, 0 answered
  1. Gagandeep
    Gagandeep avatar
    8 posts
    Registered:
    29 Nov 2011
    19 Dec 2011
    Link to this post
    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




  2. Boyko Karadzhov
    Boyko Karadzhov avatar
    56 posts
    Registered:
    05 Dec 2016
    22 Dec 2011
    Link to this post
    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
2 posts, 0 answered