Sample code to check Kentico Xperience Object alternative form.
Kentico Xperience is a powerful CMS that build from asp.net framework. The CMS have an eCommerce solution, Intranet and collaboration, Online Marketing, and Content management that make Kentico Xperience is the most popular CMS nowadays.
In Kentico Objects, you can create alternative forms allow you to create different versions of existing forms. The alternative forms can then be used instead of the default form in the system's administration interface or on the live site.
This is the snippet for Kentico version 8.xx to check if the page type has an alternative form.
In Kentico Objects, you can create alternative forms allow you to create different versions of existing forms. The alternative forms can then be used instead of the default form in the system's administration interface or on the live site.
This is the snippet for Kentico version 8.xx to check if the page type has an alternative form.
Code Behind
1: public bool CheckIfPageTypeHaveAlternativeForm(string EditFormName,string classID)
2: {
3: bool haveForm = false;
4: if (classID != "")
5: {
6: if (CMS.DocumentEngine.CMSDataContext.Current.AlternativeForms.GetSubsetWhere("FormClassID = " + classID).Count > 0)
7: {
8: var DataInfo = CMS.DocumentEngine.CMSDataContext.Current.AlternativeForms.GetSubsetWhere("FormClassID = " + classID);
9: foreach (CMS.DataEngine.BaseInfo a in DataInfo)
10: {
11: string formName = ValidationHelper.GetString(a.GetValue("FormName"), "");
12: if (formName.Contains(EditFormName))
13: {
14: haveForm = true; break;
15: }
16: }
17: }
18: }
19: return haveForm;
20: }