Access property of MasterView which Designer class

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

Access property of MasterView which Designer class

All Replies

Posted by Community Admin on 27-Feb-2013 00:00

We have a custom BlogPost designer template based from this:


www.sitefinity.com/.../extending-sitefinity-contentselectorsdesignerviews

 

We have a blog post view template, BlogPostMasterView,  that
has our own tag links control. This tag links control lists all the tags related
to that blog post and the tag links are expected to redirect to the same page
or to a different page. We need a way to provide the user the ability to select
that page. Our idea is to have a page selector from the blog post designer then
once the user selects the page and clicks save, the designer will access a
property from the BlogPostMasterView and pass that id of that selected page.

 

Once that done the BlogPostMasterView will use the id of the
property to determine what page it wants to be used. Our problem is we don’t
know how to access that property within the blog post designer. We know that we
can access the masterview from the update client side event of the designer, this.get_currentMasterView(),
but our property is still not there. We tried to add the property to the
descriptor but we get an error “Value cannot be null. Parameter name: source”. 

public override IEnumerable<ScriptDescriptor> GetScriptDescriptors()
       
            var baseDesc = (ScriptControlDescriptor)base.GetScriptDescriptors().Last();
            baseDesc.AddProperty("TestProperty", TestProperty);
            return new[] baseDesc ;
       

        private string _TestProperty;
        public string TestProperty get return _TestProperty; set _TestProperty = value;


How do we achieve this objective?

Posted by Community Admin on 28-Feb-2013 00:00

Any idea?

Posted by Community Admin on 28-Feb-2013 00:00

To explain to more in detail I will give another example kinda similar to the one above.

In our BlogPostMasterView template, list of all blog posts, we have a LinkButton with the purpose of redirecting a user to another page that lists all the blog posts. We want the ability to provide a way for a backend user to select a page from the blog post designer. This selected page will be identified as the page where the user will be taken once they click the linkbutton. 

Again as explained above we know how to add the pageselector but we don't know how to make that value accessible by the BlogPostMasterView.

Thank you

Posted by Community Admin on 04-Mar-2013 00:00

Hi Ernest,

Wouldn't the default functionality provided by the SingleItemSettings designer view (where you can select a page where the detail item opens) work out for you, or the specific use case scenario is different?

The “Value cannot be null. Parameter name: source” exception usually indicates a problem with the embedded template or an incorrectly specified virtual path, can you please ensure that these have been setup correctly?

All the best,
Boyan Barnev
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

Posted by Community Admin on 04-Mar-2013 00:00

Hi Boyan,

Thank you for your reply. The default functionality works for providing a link to the blog post details page. What we want is for the tags links to redirect to a different page, different from the one that's assigned by the above mentioned default functionality. Here's a list of pages that's related to this objective:

Blog-Post-Listing - a page that lists blogs posts. Each blog post has a one or more tag links. The tag links is expected to redirect to a specific page, Blog-Post-Tags.

Blog-Post-Details - detail view of the blog post.

Blog-Post-Tags - this page doesn't exist yet until we this question gets resolved. Basically this page has instance of the blog post control. It will list all the blog posts associated to a tag.

We could ideally hard-code this page but we're hoping to make the option available for the user in case they want to change the page in the future. 

Thank you for your support.

This thread is closed