Kentico 8.xx - Snippet to check if page type have alternative form name
This is the snippet for Kentico version 8.xx to check if page type have alternative form.
By Mohd Zulkamal
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)
Code Behind
public bool CheckIfPageTypeHaveAlternativeForm(string EditFormName,string classID)
{
bool haveForm = false;
string strEditFormName = ValidationHelper.GetString(EditFormName, "");
if (classID != "")
{
if (CMS.DocumentEngine.CMSDataContext.Current.AlternativeForms.GetSubsetWhere("FormClassID = " + classID).Count > 0)
{
var DataInfo = CMS.DocumentEngine.CMSDataContext.Current.AlternativeForms.GetSubsetWhere("FormClassID = " + classID);
foreach (CMS.DataEngine.BaseInfo a in DataInfo)
{
string formName = ValidationHelper.GetString(a.GetValue("FormName"), "");
if (formName.Contains(strEditFormName))
{
haveForm = true; break;
}
}
}
}
return haveForm;
}
By Mohd Zulkamal
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)