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 page type have 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: }
0 comments:
Post a Comment