In the Kentico Documentation I only found the info as below...
Is there any way to access the properties value in the layout as show below? I tried to use macro but it didn't work.
I just want to display the properties value in my custom layout. Any methods other than access through the code? I'm using portal engine, I have no idea how to access the code behind...
The layout is ASCX
, so you won't be able to use macros as per your example.
GetValue
method. There's also GetStringValue
, if the type of your property is a string
<% GetStringValue("MyPropertiesValue1", string.Empty); %>
Page.DataBind()
and use a data binding expression. Your layout would look something like this: <%# GetStringValue("MyPropertiesValue1", string.Empty) %>
<%# GetStringValue("MyPropertiesValue2", string.Empty) %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Page.DataBind();
}
</script>
None if this is really elegant, so you might want to reconsider your approach.