sitecore6 - How to render in a Sitecore sublayout the content of some field in a parameter template and make it page editable? -
i have sublayout want able use on multiple pages. need show title bar @ top of sublayout , created parameters template contains title field. want display title in sc:text
or sc:fieldrenderer
control, able page edit value. how do this?
on ascx can have <%= title %>
in codebehind can declare this:
public string title { get; set; }
and in page_load:
string rawparameters = attributes["sc_parameters"]; namevaluecollection parameters = sitecore.web.webutil.parseurlparameters(rawparameters); title = parameters["title"];
assuming of course you're doing code on ascx file.
although doesn't let edit in page editor.
this article read on
[edit]
figured i'd add code i'm using myself:
i have helperclass does:
public paramhelper(system.web.ui.usercontrol control) { _sublayout = control.parent sitecore.web.ui.webcontrols.sublayout; if (_sublayout != null) { _params = sitecore.web.webutil.parseurlparameters(_sublayout.parameters); } }
and can params:
public string getparam( string key ) { string result = _params[key.trim().tolower()]; if (string.isnullorempty(result)) { result = string.empty; } return (system.web.httputility.urldecode(result)); }
Comments
Post a Comment