More in this section
Categories
Bloggers
Blogs RSS feed

Removing child views from the View

by User Not Found

[This post is part of the developer's manual preview published on this blog. You can find temporary TOC here.]

 
[This article requires Sitefinity 3.6 hotfix to be installed

 

In the article preceding this one, we have seen how one can add a brand new child view to a View. In this article we will do exactly the opposite. We are going to remove an existing child view from a View.
The principle for removing the child view is basically the same as for adding it, though instead of the add method, this time we will use remove method.

 

Scenario: cripple the Events module

 

Our ever demanding boss has decided that “Geomapping settings” has no business in the Events module and she wants it gone. Once we are done there should be no user interface command for accessing Geomapping settings, nor should there be any other way to access it. To refresh your memory and get a clearer picture of what are we about to do, take a look at the following image.

 


 

Implementation


As it was the case with adding a new child view, yet again we need an ability to access the child views collection of a host view in order to remove the view. Since we are working with the Events module this time, the root view which is the host to GeomappingSettingsView is EventsControlPanel.

 

To remove the GeomappingSettingsView, all we need to do is set the following declaration in our Controls Config file.

<?xml version="1.0" encoding="utf-8"?> 
<controlsConfig> 
  <viewMap> 
    <!--Root view of the Events module.--> 
    <viewSettings hostType="Telerik.Events.WebControls.Admin.EventsControlPanel"
      <views> 
        <remove name="GeomappingSettingsView`1" /> 
      </views> 
    </viewSettings> 
  </viewMap> 
</controlsConfig> 
 

As you can see, our logic is exactly the same as it was when we were adding a new view, but this time we are removing the View. 

 

26 comments

Leave a comment
  1. Romi Feb 25, 2009
    Hi, Thanks for this Manual on fly.
    Could you make this same issue codebehind. For sample if some user has role "Custom" remove pthis child view.
  2. Ivan Feb 25, 2009
    Hi Romi,

    yes, of course, it is possible to handle the Views in the code - Controls Config file is just an alternative. ViewModeControl (and ViewModeUserControl) base classes have a virtual Method "CreateViews" which is called to create child views. So in this method, you can implement various conditions such as user role in your example and decide which child View you will create and which one you will not. You can find more information on this subject in this article: http://blogs.sitefinity.com/Ivan/Posts/09-02-19/Sitefinity_3_6_new_backend_architecture_-_What_are_Views.aspx

    If you are looking for doing this for one of the built-in Views, you can apply the technique of replacing Views, which is described in this article: http://blogs.sitefinity.com/Ivan/Posts/09-02-25/Replacing_a_child_view_with_another_one.aspx . What you would do is basically, create a new implementation of the desired host View, override the CreateViews method and put your conditioning logic in there.

    I hope this makes sense.
  3. Warmtepompen Apr 09, 2018
    Outstanding post, you have pointed out some  excellent  points , I  likewise  think  this s a very good  website. Warmtepompen
  4. emagrecimento para mamaes Apr 16, 2018
    “I’m      delighted I came across it. I’ll be back down the track to check out other      posts” emagrecimento para mamaes
  5. air data test set Apr 17, 2018
    Simply wanna input on few general things, The website layout is perfect, the subject matter is really wonderful : D. air data test set
  6. emergency bed bug inspection nyc Apr 24, 2018
    My partner and i continually go to your website and also retrieve everything you submit the following but I in no way left a comment however nowadays once i observed this kind of submit, i could not quit personally coming from commenting right here. great mate! emergency bed bug inspection nyc
  7. 2nd puc karnataka results Apr 28, 2018

    thank you for the tutorial you helped me to understand the theory behind this

    PUC Karnataka Results 2018

  8. Lucky patcher apk Apr 29, 2018
    I  likewise   believe   thus, perfectly  pent  post! . Lucky patcher apk
  9. Alexander Apr 30, 2018
    Very interesting points  you have  observed , thanks  for posting . Alexander
  10. wildlife safari May 05, 2018
    Eh oui et aussi pas vraiment. Certes en effet on détermine de nouvelles sources qui se référent les memes significations. Non étant donné que il n’est pas suffisant de répéter ce que tout le monde est en mesure de voir chez certains sites tiers puis le traduire tant simplement? wildlife safari
  11. a course in miracles May 08, 2018
    Came clueless, left worried. Thanks for the post.  Sometimes I wonder whether the planet is being run by smart people who are putting us on or by imbeciles who really mean it. a course in miracles
  12. http://www.comparebear.net May 09, 2018
    Blasphemy! : ) Simply kidding. Ive go through related points upon various other weblogs. Sick acquire your term for this. Continue to be sound!  the companion. http://www.comparebear.net
  13. ae May 09, 2018

    I have perused a couple of the articles on your site now, and I truly like your style. 

    Buy Instagram accounts

  14. Truck mounted computer May 17, 2018
    This problem will only come to be more exacerbated as more people start out ‘cocooning’ within their houses. If you prefer to know more about social multi-level marketing, you’ll want to make investments some time and hard earned cash in excellent knowledge that may make your website potential customers explode. Truck mounted computer
  15. order custom patches May 25, 2018
    best customer service in the world when you buy from The Patch Factory! order custom patches
  16. great post to read from  May 25, 2018
     We are in the business of creating security companies and keeping them in business. great post to read from 
  17. house cleaning tuscaloosa Jun 11, 2018
    Oh my goodness! a wonderful post dude. Many thanks Even so I am experiencing problem with ur rss . Do not know why Can not enroll in it. Will there be everyone getting identical rss difficulty? Anyone who knows kindly respond. Thnkx house cleaning tuscaloosa
  18. UFABET Jun 13, 2018
    Spot i’ll carry on with this write-up, I must say i think this site requirements far more consideration. I’ll oftimes be once more to study additional, appreciate your that information. UFABET
  19. lookbeauty Jun 14, 2018
    I found your blog on yahoo and can bookmark it now. maintain the great work. lookbeauty
  20. links Jun 22, 2018
    Improve your website’s search engine ranking with various quality backlinks from high authority .domains. links
  21. https://couplecounseling.webnode.com/ Jun 22, 2018
    very nice post, i absolutely adore this web site, keep on it https://couplecounseling.webnode.com/
  22. بهترین وکیل تهران Jun 23, 2018
    very nice put up, i actually love this web site, keep on it بهترین وکیل تهران
  23. singapore restaurant kitchen equipment Jun 25, 2018
    Top post Genachowski’s less than artful weaving of net neutrality and consumer privacy | Law and Politics of Broadband you’ve surely influenced all of us  FYI have you read Middle East amazing headlines! Enjoy your day ! Flash Website Design singapore restaurant kitchen equipment
  24. actual day wedding photography singapore Jun 25, 2018
    Thank you, I’ve just been searching for info about this subject for a long time and yours is the best I have discovered till now. But, what in regards to the conclusion? Are you positive about the source? actual day wedding photography singapore
  25. singapore kidzania promotion Jun 25, 2018
    Can I just say what a reduction to find somebody who really is aware of what theyre speaking about on the internet. You definitely know the right way to carry a difficulty to mild and make it important. More people must learn this and perceive this facet of the story. I cant imagine youre no more in style since you definitely have the gift. singapore kidzania promotion
  26. singapore braces instalment Jun 25, 2018
    That is some inspirational stuff. Couldn’t know that opinions can be this varied. Thank you for most of the enthusiasm to consider such tips here. singapore braces instalment

    Leave a comment