Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7962385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:19:22+00:00 2026-06-04T05:19:22+00:00

This is my rule where user profile fb_likes field contains sitecore set data source

  • 0

This is my rule

where user profile fb_likes field contains sitecore

set data source to TestItem2

I have applied this rule to a sublayout on standard values of the template,but this rule never change the data source.

I have also tried this condition

where true (action always execute).

but again no luck,

if I change action to

hide rendering

it works fine.
what I’m doing wrong here??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T05:19:23+00:00Added an answer on June 4, 2026 at 5:19 am

    Does the code of your sublayout make allowances for using the Datasource when it is set over the context item? You can achieve this in a number of ways. E.g in a base class:

        protected string DataSource
        {
            get
            {
                var sublayout = Parent as SublayoutBase;
                return sublayout == null ? string.Empty : sublayout.DataSource;
            }
        }
    
        protected Item DataSourceItem
        {
            get
            {
                return string.IsNullOrEmpty(DataSource)
                           ? Sitecore.Context.Item
                           : Sitecore.Context.Database.GetItem(DataSource) ?? Sitecore.Context.Item;
            }
        }
    

    Then inside your code for your sublayout use the DatSourceItem rather then the context item to display content. Another way I have seen this done is to:

        protected override void Render(HtmlTextWriter writer)
        {
            if (this.DataSourceItem != null)
                using (new Sitecore.Data.Items.ContextItemSwitcher(this.DataSourceItem ))
                {
                    base.Render(writer);
                }
            else
            {
                base.Render(writer);
            }
        }
    

    Using this all your sublayouts that inherit this in their base class will natively support Data source even if the code is written against the Context item.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have currently my user profile pages like this www.mysite.com/profile/sohailanwarpk and htaccess rule for
In my model named Profile_model I have this function which retrieves profile data for
I have this rule: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !index.php RewriteRule ^(.*)$ index.php?req=$1
I have added this rule in my web.config to redirect non www URLs to
I have this rule in an .htaccess file located in a directory named clips/
I have this rewrite rule that turns foo.com/test (or foo.com/test/) into foo.com/test.txt: RewriteRule ^test/?$
I have this rewrite rule in my web.config: <RewriterRule> <LookFor>/RecoverPassword.aspx</LookFor> <SendTo>/Logon.aspx?t=pr</SendTo> </RewriterRule> Well, the
So I have this rule in place # Rewrite for account view RewriteRule ^([^/]+)/([^/]+)/?$
I have this rule: RewriteRule ^(panel|admin|site)/([A-Za-z0-9]+?)/(scripts|assets)/(.*)$ Project/$2/Public/$3/$1/$4 [L] The idea is to allow access
i have this rewrite rule for my urls, it deosnt seem to acess the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.