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

Forums / Developing with Sitefinity / Any way to "refresh" all news control to use external templates

Any way to "refresh" all news control to use external templates

4 posts, 0 answered
  1. Victor
    Victor avatar
    44 posts
    Registered:
    10 Mar 2009
    29 May 2009
    Link to this post
    I created an external template for newsview following a similar procedure to Blogs one.

    Now the problem I have is to make the existing pages use this control the only way is to go edit each page, delete NewsView control, put it back.

    This is a big issue since we have like 15 pages with newsview control on them, each one with a different properties set.

    I was looking at a way to do this "refresh" programatically but can't figure out what is Sitefinity updating in the database to make each of these controls pick up the external template, any help is appreciated.

    btw: this kind of issue (imho) defeats the whole purpose of having view templates, changing the template should automatically apply to all controls using it.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    29 May 2009
    Link to this post
    Hi Victor,

    The situation with NewsView control is the same as this one described in the following forum post - 
    http://www.sitefinity.com/support/forums/support-forum-thread/b1043S-cbkbee.aspx
    NewsView and BlogPosts are ContentView based controls.

    Options.

    1.Mapping the templates through the control designer UI - applies to a single control
    2. Using the mapped ContentView based control designer and setting the templates declaratively - applies to all controls. This approach requires changing the presentation mode and then reverting back to the desired one or readding the control on the page.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Victor
    Victor avatar
    44 posts
    Registered:
    10 Mar 2009
    29 May 2009
    Link to this post
    --- quote ---
    This approach requires changing the presentation mode and then reverting back to the desired one or readding the control on the page.
    --- quote ---

    But there are no presentation options in the NewsView control, only "list & page" is available. Other option is to delete and put control back but that is not very practical for us.

    Is there a way to do this straight in the database?, as I said, we have like 15 of these with different properties and would take us forever to do each one.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    29 May 2009
    Link to this post
    Hi Victor,

    You can remove and add the controls programmatically, but your properties will be lost.

     page.Staged.AddControl("Content"typeof(NewsView), 0, "Content1");  


    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
4 posts, 0 answered