Saturday, 3 October 2015

Kentico 8.xx - Snippet to check if page type have alternative form name

Leave a Comment
This is the snippet for Kentico version 8.xx to check if page type have alternative form.

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
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 =)

0 comments:

Post a Comment

Subscribe to our newsletter to get the latest updates to your inbox.

Your email address is safe with us!




Founder of developersnote.com, love programming and help others people. Work as Software Developer. Graduated from UiTM and continue study in Software Engineering at UTMSpace. Follow him on Twitter , or Facebook or .



Powered by Blogger.