I've got a usercontrol which I'm saving as a macro. However I'm not able to call any properties from my usercontrol. Does somebody have a good example? I found this, but it's a bit old. Here is my code perhaps somebody knows what I'm doing wrong.
public partial class Contact : FormulierUserControl, IDefaultEmailFormProperties
{
#region Properties
public string SenderPlaceHolder
{
get;
set;
}
public string ReceiverPlaceHolder
{
get;
set;
}
public string CCPlaceHolder
{
get;
set;
}
public string BCCPlaceHolder
{
get;
set;
}
#endregion
}
When I'm trying to read any of these properties there always null.
[% will get replaced (it wants to retrieve the parameter test from a cookie collection). What I would do is just choose another prefix or suffix for you placeholder like _@ @_ , or pass the value test to ReceiverPlaceHolder and surround it with [% and %] in the usercontrol.
Thanks for the info. I was already thinking about the second option. I'm just going to surround my placeholder with [% and %] in the usercontrol. This way the parameters in umbraco are also more readable :).
Macro properties
Hello,
I've got a usercontrol which I'm saving as a macro. However I'm not able to call any properties from my usercontrol. Does somebody have a good example? I found this, but it's a bit old. Here is my code perhaps somebody knows what I'm doing wrong.
When I'm trying to read any of these properties there always null.
Hi Jeroen,
In which event are you reading the properties? I Guess you should use the Load event and see what happens.
Cheers,
Richard
Where do you read? in PageLoad or Initialize?
Did you set up the parameters in the macro? Did you fill in values the Properties?
I didn't had any problems using properties in an usercontrol
the syntax seems to be ok
Hmm seems the problem is the value I'm trying to put into the macro:
This works:
<umbraco:Macro ReceiverPlaceHolder="test" Alias="[CC]Contact" runat="server"></umbraco:Macro>
And this doesn't work:
<umbraco:Macro ReceiverPlaceHolder="[%test%]" Alias="[CC]Contact" runat="server"></umbraco:Macro>
Does somebody know how I can get it to work with [%%] in the string?
try "[%test%]" as % is the ascii code for %
hth, Thomas
Nope still doesn't work.
Hi Jeroen,
[% will get replaced (it wants to retrieve the parameter test from a cookie collection). What I would do is just choose another prefix or suffix for you placeholder like _@ @_ , or pass the value test to ReceiverPlaceHolder and surround it with [% and %] in the usercontrol.
Hope it helps you,
Richard
Hi Richard,
Thanks for the info. I was already thinking about the second option. I'm just going to surround my placeholder with [% and %] in the usercontrol. This way the parameters in umbraco are also more readable :).
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.