Tuesday, 1 September 2009

How to display Dynamic Content without Property control

Recently I was investigating EPiServer's Dynamic Content a bit. General impression is very positive, Dynamic Content is a great feature. From developer's point of view it's fairly easy to develop custom Dynamic Content, everything works like charm .... maybe beside one thing :)

Unfortunately, to display property's value with dynamic content replaced with our controls it's required to use EPiServer's control:

   1:  <EPiServer:Property PropertyName="MainBody" runat="server" />

Different approaches won't work.

   1:  <%= CurrentPage["MainBody"] %>
   2:  <%= CurrentPage.Property["MainBody"] %>
   3:  litMainBody.Text = CurrentPage.Property["MainBody"].ToWebString()



It is a considerable drawback as there are cases in which it's required to do something with property's value before displaying it:
  • For example you may want to alter all links by adding some extra parameters
  • When using Model-View-Presenter (flavor of MVC) you want to pass only pure data to the view.
It was worth spending some time to find a workaround. In the end, solution turned out to be not so convoluted, here is a control which takes a string and displays it replacing any dynamic content with corresponding controls.

   1:  public partial class DynamicContent : UserControlBase
   2:  {
   3:      public string StringToDisplay
   4:      {
   5:          set
   6:          {
   7:              var propertyControl = new PropertyLongStringControl
   8:                                        {
   9:                                            Page = Page,
  10:                                            PropertyData = new PropertyXhtmlString(value)
  11:                                        };
  12:              Controls.Add(propertyControl);
  13:          }
  14:      }
  15:  }

And the usage is really straightforward:

   1:  <unit:DynamicContent runat="server" id="dcMainBody" />
   2:  
   3:  dcMainBody.StringToDisplay = CurrentPage.Property["MainBody"].ToWebString();

Before calling dcMainBody.StringToDisplay you can of course change property's value in any arbitrary way.

Hope it will save someone a bit of time :)

45 comments:

Ted Nyberg said...

It seems we ran into these problems at almost the same time! :) I posted another workaround here.

AlanBarlow said...

This got me interested, time to learn something new. Make sure to check below:
buy a logo

french bulldog puppies for sale said...

its been long since i saw a post that's so educative and informational. i will make sure to share this my facebook group. you can also view contents on our websites below.

French Bulldog Puppies For Sale

French Bulldog Breeders

French Bulldog Puppies For Sale Near Me

French Bulldog Puppies For adoption

French Bulldog Puppies


Blue French Bulldog Puppies

mike said...

f1 savannah kittens For Sale

Bengal Kittens For Sale

Cats for sale

alexgreenn said...

We understand our clients, and we know that they need only elite Hot and Sexy Call Girls in Chanakyapuri.
If you have desires and fantasises that never came true, then you are in for a treat. Hiring an Busty Call Girls in Goa will give you the chance to enjoy a lot.
Our super hot Busty Call Girls in Goa are meant for providing best pleasures.
Just call us on the given numbers and we bet that you are going to enjoy with Top Call Girls in Agra.
There are lots of Top Call Girls in Agra available for you. We have lots of variety to offer too.
You can get Top Call Girls in Ajmer, Bengali, Bihari, Punjabi, Latin, Russian, and lots more. Variety is key to us because clients prefer changes in their life.

siberian husky puppies said...

siberian husky puppies for sale near me
Siberian Husky puppies
Siberian Husky puppies for adoption
  Siberian Husky puppies breeders near me  

sweet dreams cattery said...

French Bulldog Puppies for sale near me
French Bulldog Puppies for sale
Blue French Bulldog Puppies for sale

sweet dreams cattery said...

 miniature dachshund Puppies For Sale Near Me
 cheap Puppies For adoption
 Dapple dachshund Puppies For Sale Near Me
Dachshund Puppies For Adoption 

Boxer Puppies For Sale said...


Golden Retriever Puppies For Sale Near me
Labrador Retriever Puppies For Sale Near me
Golden Retriever Puppies For Sale
Labrador Retriever Puppies For Sale
Golden Retriever Puppies For Sale 

Anonymous said...

The goal of all treatment for Anxiety and Panic Attacks is the alleviation of symptoms.


stilnoct online sverige

køb imovane i sverige

köp oxycodone i sverige

reductil köpareductil köpa

valium 10mg

xanax 2 mg

Pluggenapotek said...

Anxiety and Panic Attacks can be cured!
The goal of all treatment for Anxiety and Panic Attacks is the alleviation of symptoms.


stilnoct online sverige

køb imovane i sverige

köp oxycodone i sverige

reductil köpareductil köpa

valium 10mg

xanax 2 mg

Pluggenapotek said...

Taking your medicine as prescribed or medication adherence is important for controlling chronic conditions,
treating temporary conditions, and overall long-term health and well-being. A personal connection with your health-care
provider or pharmacist is an important part of medication adherence


adderall danmark

adderall sverige

stilnoct online sverige

köpa imovane

Pluggenapotek said...

Å ta medisinen din som foreskrevet eller medikamentoverholdelse er viktig for å kontrollere kroniske tilstander,
behandling av midlertidige forhold, og generelt langsiktig helse og velvære. En personlig forbindelse med helsevesenet
leverandør eller apotek er en viktig del av overholdelse av medisiner




tramadol pris

tramadol 100mg

imovane

kjøpt tramadol i sverige

https://goldyorkie.com/teacup-yorkie-puppies-for-sale-near-me/ said...

Cute purebred male and female yorkie puppies ready We now have good looking puppies ready for good homes,For more information and your recent photos. Thanks.visit my website below


yorkie puppies for sale

yorkies for sale

yorkies for sale near me

cheap yorkie puppies for sale

micro yorkie puppies for sale

tiny teacup yorkie puppies for sale near me

mini yorkie puppies for sale

teacup yorkies for sale

micro yorkies for sale

teacup yorkie for sale cheap

teacup yorkies for sale near me

micro teacup yorkie for sale

Teacup yorkie puppies for sale

Toy/Tiny Yorkie Puppies for sale

mini yorkie puppies for sale near me

tiny teacup yorkie puppies for sale

yorkie puppies for adoption

teacup yorkie puppies for adoption

miniature yorkie puppies for sale

miniature yorkies for sale

Mini Yorkies High Quality Puppies

micro teacup yorkie

Boston Terrier Puppies For Sale said...

Boston Terrier Puppies Are One Of The Breed Of Puppies To Love And Care For Check It Out Below

https://bostonterrierfamily.com/


Boston Terrier Puppies For Sale

Boston Terrier Puppies For Sale In USA

Boston Terrier Puppies For Sale Near Me

Boston Terrier Puppies Rescue

Boston Terrier Puppies Near Me

Boston Terrier Puppies Sales

Boston Terrier Puppies For Adoption

Cheap Boston Terrier Puppies

Boston Terrier Breeders

Blue Boston Terrier Puppies For Sale

Mini Boston Terrier Puppies For Sale

Red Boston Terrier Puppies For Sale

Exotic Paw said...

Savannah kattungar till salu
Savannah kattungar till salu
katter till salu
stora katter till salu
kattungar nära mig
huskatter till salu
köp kattungar online
F2 Savannah kattungar till salu

Pluggenapotek said...

Att ta ditt läkemedel enligt ordination eller vidhäftning av läkemedel är viktigt för att kontrollera kroniska tillstånd.
behandling av tillfälliga tillstånd och övergripande långvarig hälsa och välbefinnande. En personlig koppling till din vård
leverantör eller apotekare är en viktig del av medicintekniken



imovane 7 5 mg

adderall

stilnoct

imovane

Pluggenapotek said...

At tage din medicin som ordineret eller medicinoverholdelse er vigtig for at kontrollere kroniske tilstande,
behandling af midlertidige tilstande og generel langvarig sundhed og velvære. En personlig forbindelse med din sundhedspleje
udbyder eller apotek er en vigtig del af overholdelse af medicin


adderall danmark
køb imovane i danmark
köpa imovane
imovane

Pluggenapotek said...

Läkemedel är kemikalier eller föreningar som används för att bota, stoppa eller förebygga sjukdomar. lindra symtom; eller hjälp vid diagnos av sjukdomar.
Framsteg inom läkemedel har gjort det möjligt för läkare att bota många sjukdomar och rädda liv.

sibutramin online
imovane
köpa imovane
adderall danmark
adderall pris
xanax 2 mg

German Shepherd Puppies For Sale said...

Greate Dane puppies available
Great Dane puppies for sale
big dogs for sale
great Dane puppies near me
cute puppies for sale
puppies online
buy great Dane puppies online
harlequin puppies for sale

Breeders said...


Great Dane Puppies For Sale

Great Dane Puppies   

great dane for sale

Blue Merle great dane puppies for sale   





black great dane puppies  


 
Mantle Great Dane puppies for sale  

Blue Merle Great Dane puppies for sale  

Great Dane puppies for sale  

Blue Great Dane puppies for sale

Great Dane puppies for sale  

pluggenapotek said...

Taking your medicine as prescribed or medication adherence is important for controlling chronic conditions,
treating temporary conditions, and overall long-term health and well-being. A personal connection with your health-care provider or pharmacist is an important part of medication adherence.

imovane
köpa imovane i danmark
imovane 7 5 mg
reductil sibutramine 15mg
oxikodon pris
tramadol 100mg

Lisa Benson said...

Lisa Star Yorkie puppies is dedicated in the breeding of the finest quality, Yorkie puppies at the most reasonable prices. We sell the cutest Yorkie puppies our selection are the best and this breed give us the joy and happiness to continue the breeding, contact us now and get the best
https://www.lisabensonyorkies.com
yorkie puppies for sale
yorkie puppies
yorkies for sale
yorkies for sale near me
yorkie puppies for sale near me
yorkie puppy for sale
teacup puppies for sale near me
teacup yorkie for sale
yorkshire terrier puppies for sale
teacup yorkie puppies for sale
yorkies near me
yorkshire terriers for sale
yorkies puppies for sale
teacup yorkies near me
yorkie puppies for adoption

yorkie puppies for sale said...

yorkie puppies for sale
teacup yorkie puppies for sale
yorkie puppies for sale near me
teacup yorkie puppies for sale near me
yorkies for sale
micro teacup yorkie for sale
micro yorkie puppies for sale
tiny teacup yorkie puppies for sale near me
teacup yorkies for sale near me
cheap yorkie puppies for sale
mini yorkie puppies for sale
teacup yorkies for sale
micro yorkies for sale
teacup yorkie for sale cheap

plugapotek said...

Målet med all behandling för ångest och panikattacker är lindring av symtom.

adderall danmark

adderall sverige

köpa imovane

reductil 15mg

tramadol 100mg

imovane

exoticanimalsforpetlovers said...

Buy Real Driver License Online .A drivers license happens to be an official document which gives permission to different types of drivers to operate or drive different vehicles on public roads without any fears. It is usually in the form and size of a credit card. legitsdocumentts.com provides you with the opportunity to grab an authentic drivers license online without taking any tests. Here at legitdocumentts, we provide all classes and types of driving license which includes the following; Firstly, Category A. AM (Moped) Secondly, Category B. B1 (Light Vehicle Automatic) Thirdly, Category C. C1 (Light Truck) Nonetheless,Category D. D1 (Van) However, Category E. Age: 21 – 65 years (Licensed as EC1, EC, ECE, ED, ED1, ED2 and ECD3) Category F (Persons with Disability) Category G. australian drivers license for-sale fake driving license for sale So if you need a place where you can get a real driving license online, search no further because we make your dreams come true in few days. All you need to do is go to our website and place your order. Trust me we will make all your dreams come true.

apotek90 said...

At tage din medicin som foreskrevet, eller at medicinsk overholdelse er vigtig for at kontrollere kroniske tilstande,
behandling af midlertidige forhold og generelt langsigtet sundhed og velvære. En personlig forbindelse med din læge eller apotek er en vigtig del af medicinoverholdelse.

imovane
køb imovane i danmark
imovane 7 5 mg
reductil sibutramin 15mg
xanax gadepris
Köp Sobrilmg

pluggenapotek said...

Taking your medicine as prescribed or medication adherence is important for controlling chronic conditions,
treating temporary conditions, and overall long-term health and well-being. A personal connection with your health-care provider or pharmacist is an important part of medication adherence.

Kjøp imovane online Norge
Zolpidem køb online
köpa imovane i sverige
Köpa Reductil 15mg i Sverige
kop sobril utan recept
kop concerta 54 mg i sverige

pluggenapoteksdn said...

At tage din medicin som foreskrevet, eller at medicinsk overholdelse er vigtig for at kontrollere kroniske tilstande,
behandling af midlertidige forhold og generelt langsigtet sundhed og velvære. En personlig forbindelse med din læge eller apotek er en vigtig del af medicinoverholdelse.

Køb imovane online Norge
Zolpidem køb online
køb imovane i sverige
Köpa Reductil 15mg i Sverige
kop sobril utan recept
kop concerta 54 mg i sverige

pluggenapotek said...

Taking your medicine as prescribed or medication adherence is important for controlling chronic conditions,
treating temporary conditions, and overall long-term health and well-being. A personal connection with your health-care provider or pharmacist is an important part of medication adherence.

Kjøp imovane online Norge
köpa imovane i danmark
køb imovane i sverige
reductil
sobril uten resept
adderall sverige


pluggenapotek said...

treating temporary conditions, and overall long-term health and well-being. A personal connection with your health-care provider or pharmacist is an important part of medication adherence.

Kjøp imovane online Norge
köpa imovane i danmark
køb imovane i sverige
reductil
sobril uten resept
adderall sverige

pluggenapotekcsm1 said...

Å ta medisinen som foreskrevet eller medisinering er viktig for å kontrollere kroniske tilstander,
behandling av midlertidige forhold og generell langsiktig helse og velvære. En personlig forbindelse med helsepersonell eller apotek er en viktig del av medisinering.

Kjøp imovane online Norge
kjøpe imovane i danmark
kjøp imovane i sverige
reductil
sobril uten resept
adderall sverige

Gavin Poms said...

Hello, Gavin Teacup Poms have beautiful, sweet, friendly energetic Pomeranian puppies for sale !our puppies are up to date on vaccinations and wormings, vet checked. They comes pre spoiled , with food and treats,health record, vet certificate. They can be ACA registered. Contact us through our website today to meet with them.
https://www.gavinteacuppomeranianpuppies.com/
https://www.gavinteacuppomeranianpuppies.com/Pomeranian-puppies-for-sale-near-me.html



Pomeranian Puppies For Sale In USA
Pomeranian Puppies For Sale Near Me
Pomeranian Puppies For Adoption
Cheap Pomeranian Puppies
Pomeranian Breeders
White Pomeranian Puppies For Sale
Mini Pomeranian Puppies For Sale
Black Pomeranian Puppies For Sale
mini Pomeranian puppies for sale
teacup Pomeranians for sale near me
micro teacup Pomeranians for sale
Teacup Pomeranian puppies for sale
Toy/Tiny Pomeranian Puppies for sale
mini Pomeranian puppies for sale near me
tiny teacup Pomeranian puppies for sale
Pomeranian puppies for adoption
teacup Pomeranian puppies for adoption
miniature Pomeranian puppies for sale

Aaron's Exotic Paw said...

Exotic kittens online....
Savannah kittens for sale
Serval kittens for sale
Caracal kittens for sale
savannah cat sale price
Serval cat price
full grown f1 savannah cat price
Caracal cat price

pillsonlinehub said...

Målet med all behandling for angst og panikkanfall er å lindre symptomene.


kjøp ritalin online
köpa imovane i danmark
kjøp imovane i sverige
Adderall Danmark
sobril uten resept
adderall sverige

Gavin Poms said...

Get the Best and Healthy Purebred male and female Pomeranian puppies ready We now have good looking puppies ready for good homes. For more information and your recent photos, visit my website below. Thanks

www.gavinteacuppomeranianpuppies.com

Pomeranian Puppies For Sale
Pomeranian Puppies For Sale In USA
Pomeranian Puppies For Sale Near Me
Pomeranian Puppies Rescue
Pomeranian Puppies Near Me
Pomeranian Puppies Sales
Pomeranian Puppies For Adoption
Cheap Pomeranian Puppies
Pomeranian Breeders

pillsonline said...

Angst og panikanfald kan helbredes!
Målet med al behandling for angst og panikanfald er lindring af symptomer.


køb ritalin online
køba imovane i danmark
køb imovane i sverige
Adderall Danmark
sobril uden recept
adderall sverige

PluggenA said...

Vi måste ersätta din onda stresscykel med en ond cirkel av egenvård


köp ritalin
köpa imovane i danmark
køb imovane i sverige
adderall dansk
valium køb
adderall sverige

medprod said...

Målet med al behandling for angst og panikanfald er lindring af symptomer.


køb methylphenidat
køba imovane i danmark
køb imovane i sverige
adderall køb
sobril 25 mg gatepris
adderall köpa

Johnsonmark said...

Get the Best and Healthy Purebred male and female Great Dane puppies ready We now have good looking puppies ready for good homes. For more information and your recent photos, visit my website below. Thanks

www.gavinteacuppomeranianpuppies.com



Great Dane puppies for sale in Alabama
Great Dane puppies for sale in Arizona
Great Dane puppies for sale in California
Great Dane puppies for sale in Connecticut
Great Dane puppies for sale in Florida
Great Dane puppies for sale in Hawaii
Great Dane puppies for sale in Illinois
Great Dane puppies for sale in Iowa
Great Dane puppies for sale in Kentucky
Great Dane puppies for sale in Maine
Great Dane puppies for sale in Massachusetts
Great Dane puppies for sale in Minnesota
Great Dane puppies for sale in Missouri
Great Dane puppies for sale in Nebraska
Great Dane puppies for sale in New Hampshire
Great Dane puppies for sale in New Mexico
Great Dane puppies for sale in North Carolina
Great Dane puppies for sale in Ohio
Great Dane puppies for sale in Oregon
Great Dane puppies for sale in Rhode Island
Great Dane puppies for sale in South Dakota
Great Dane puppies for sale in Texas
Great Dane puppies for sale in Vermont
Great Dane puppies for sale in Washington
Great Dane puppies for sale in Wisconsin
Great Dane puppies for sale in Washington DC

evoseedbox said...

WEB Designing Services in Hyderabad
Such a wonderful information blog post on this topic provides assignment service at affordable cost in a wide range of subject areas for all grade levels, we are already trusted by thousands of students who struggle to write their academic papers and also by those students who simply want Assignment helpto save their time and make life easy.

pillsonline1csm said...


oxycontin danmark

valium køb

adderall danmark

anavar
köpa imovane i danmark

imovane

Lulayorkies said...

https://www.lulayorkies.com/
yorkie puppies for sale


yorkies for sale


teacup puppies for sale near me


teacup yorkies


yorkies for free


yorkie-puppies for sale near me


yorkie puppies


teacup yorkie puppies for sale


yorkie puppies for sale in usa


teacup yorkie breeders


puppies for sale near me


yorkies for sale in usa

escort service in noida said...

Thanks for shareing comments

escort job for girls in delhi said...

Thanks for shareing comments