Set UrlEvaluationMode globally for a control

Posted by Community Admin on 04-Aug-2018 18:55

Set UrlEvaluationMode globally for a control

All Replies

Posted by Community Admin on 31-May-2013 00:00

I have a custom class which inherits from DynamicContentView...so I'd like to put some code in there to tell the control to ALWAYS render in UrlEvaluation mode QueryString.

Problem is, there's no setter on the property so I can't?

Posted by Community Admin on 14-Jun-2013 00:00

Hi,

 This is how the get for UrlEvaluationMode internally works:

public UrlEvaluationMode UrlEvaluationMode
    get
    
        if (this.Page != null)
        
            var urlEvalMode = this.Page.Items[RouteHandler.UrlEvaluationModeKey];
            if (urlEvalMode != null)
            
                return (UrlEvaluationMode)urlEvalMode;
            
        
        return default(UrlEvaluationMode);
    

And is called from InitializeMasterView method in DynamicContentView

So what I am suggesting is override the InitializeMasterView and set the correct value for this.Page.Items[RouteHandler.UrlEvaluationModeKey]

Here is sample code that should do the trick:

public class CustomContentView : DynamicContentView
    protected override void InitializeMasterView()
    
        this.Page.Items[RouteHandler.UrlEvaluationModeKey] = UrlEvaluationMode.QueryString;
        base.InitializeMasterView();
    


Regards,
Stoimen Stoimenov
Telerik
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