IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
using
System;
System.Web.UI;
Telerik.Sitefinity.Abstractions.VirtualPath;
Telerik.Sitefinity.Abstractions.VirtualPath.Configuration;
Telerik.Sitefinity.Configuration.Web.UI.Basic;
Telerik.Sitefinity.Configuration;
Telerik.Sitefinity.Web.UI.Fields;
Telerik.Sitefinity.Localization;
Telerik.Sitefinity.Modules.Forms;
public
class
CustomBasicSettingsView : BasicSettingsView
{
}
protected
override
string
LayoutTemplateName
get
return
null
;
LayoutTemplatePath
if
(
.IsNullOrEmpty(
base
.LayoutTemplatePath))
CustomBasicSettingsView.layoutTemplateName;
.LayoutTemplatePath;
set
.LayoutTemplatePath = value;
static
readonly
layoutTemplateName = GenerateVirtualPath(
"ProductCatalogSample.CustomBasicSettingsView.ascx"
);
private
GenerateVirtualPath(
path)
var virtualPathConfig = Telerik.Sitefinity.Configuration.Config.Get<VirtualPathSettingsConfig>();
VirtualPathElement element =
virtualPathConfig.VirtualPaths.TryGetValue(
"~/SFProducts/*"
,
out
element);
(element ==
)
var jobsModuleVirtualPathConfig =
new
VirtualPathElement(virtualPathConfig.VirtualPaths)
VirtualPath =
ResolverName =
"EmbeddedResourceResolver"
ResourceLocation =
"ProductsModule"
};
virtualPathConfig.VirtualPaths.Add(jobsModuleVirtualPathConfig);
ConfigManager.GetManager().SaveSection(virtualPathConfig);
VirtualPathManager.Reset();
"~/SFProducts/"
+ path;
/// <inheritdoc />
void
InitializeControls(System.Web.UI.Control viewContainer)
.InitializeControls(viewContainer);
BindDropDownField();
BindCheckBoxesField();
this
.CustomSettingsDescriptionLabel.Text =
.Format(Res.Get<ProductsResources>().CustomSettingsDescription, akismetSampleLink);
In the sample above, the detailsLiteral is using a read-only variable pointing to the Akismet module in GitHub:
const
akismetSampleLink =
"https://github.com/Sitefinity-SDK/Telerik.Sitefinity.Samples.Akismet"
BindDropDownField()
.DropDownField.Choices.Clear();
//adds a default value -Select-
.DropDownField.Choices.Add(
ChoiceItem()
Text =
.Format(
"-{0}-"
, Res.Get<Labels>().Select),
Value = Guid.Empty.ToString()
});
.DropDownField.AddDefaultChoices();
BindCheckBoxesField()
.CheckBoxesField.AddDefaultChoices();
You can implement an Extension method to bind the ChoiceField. This tutorial uses the AddDefaultChoices extension method in the following way:
ChoiceFieldExtensions
AddDefaultChoices(
ChoiceField choiceField)
choiceField.Choices.Add(
ChoiceItem() { Text = Res.Get<FormsResources>().FirstChoice, Value = Res.Get<FormsResources>().FirstChoice });
ChoiceItem() { Text = Res.Get<FormsResources>().SecondChoice, Value = Res.Get<FormsResources>().SecondChoice });
ChoiceItem() { Text = Res.Get<FormsResources>().ThirdChoice, Value = Res.Get<FormsResources>().ThirdChoice });
ScriptControlDescriptor GetScriptDescriptor()
ScriptControlDescriptor(
.GetType().FullName,
.ClientID);
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important