two custom controls showing the data in only one culture

Farah El Agha asked on December 3, 2017 15:42

hi, I am using a custom control in a transformation, below is the code:

<%@ Register Src="~/CMSModules/Content/Controls/Attachments/DocumentAttachments/DocumentAttachments.ascx" TagName="DocumentAttachments" TagPrefix="cms" %>

< script>
 protected override void OnInit(EventArgs e)

{

CMS.DataEngine.DataClassInfo dci = CMS.DataEngine.DataClassInfoProvider.GetDataClassInfo(Eval("ClassName").ToString(), true);
if (dci != null)
{
  CMS.FormEngine.FormInfo fi = new CMS.FormEngine.FormInfo(dci.ClassFormDefinition);
        CMS.FormEngine.FormFieldInfo ffiReports = fi.GetFormField("Reports");  
              CMS.FormEngine.FormFieldInfo ffiFiles = fi.GetFormField("Files");  

        Guid AttachmentGroupGUIDRep = ffiReports.Guid;
              Guid AttachmentGroupGUIDRFil = ffiFiles.Guid;

        ucDocAttachmentReports.Path = Eval<string>("NodeAliasPath");
              ucDocAttachmentFiles.Path = Eval<string>("NodeAliasPath");

        ucDocAttachmentReports.AttachmentGroupGUID = AttachmentGroupGUIDRep;
              ucDocAttachmentFiles.AttachmentGroupGUID = AttachmentGroupGUIDRFil;

        ucDocAttachmentReports.TransformationName = "CMS.Root.AttachmentLinks";
              ucDocAttachmentFiles.TransformationName = "CMS.Root.AttachmentLinks";

              ucDocAttachmentReports.ReloadData(true);
              ucDocAttachmentFiles.ReloadData(true);
}

}

< /script>

 <div class="selectedElectionInfo elem-to-hide selectedContent-3">
         <cms:DocumentAttachments ID="ucDocAttachmentReports" runat="server" />

     </div>
      <div class="selectedElectionInfo elem-to-hide selectedContent-4">
                         <cms:DocumentAttachments ID="ucDocAttachmentFiles" runat="server" />
     </div>

the code is working fine for only one culture (arabic) and the attachments are showed normally, but for the second culture (english) only the Reports control is showed, but the Files control is empty, with no errors, anyone has an idea what could be the problem?

Correct Answer

Matt Nield answered on December 4, 2017 00:59

Have you checked that the attachments exist in the English version? Kentico stores the document culture agains the attachments, so if you add them in the Arabic version of the page, they will not automatically appear in the English versions.

1 votesVote for this answer Unmark Correct answer

Recent Answers


Farah El Agha answered on December 4, 2017 08:24

no I added some data, but it didnt show anything, also for the Reports control I didnt have to add any data in english, the reports were shown automatically in both cultures. do you have any idea where should I look to invest?

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on December 4, 2017 10:30

Are you showing both on the same page? Or do you have 1 page where you want to show all culture versions of this report and attachments?

0 votesVote for this answer Mark as a Correct answer

Farah El Agha answered on December 4, 2017 11:59

I dont know if I understood your question, but both reports and files are in the Home page in a separate divs, and the Home page has 2 versions, arabic and english, but they are not shown together simultaneously (if this is your question)

0 votesVote for this answer Mark as a Correct answer

Matt Nield answered on December 4, 2017 12:14

Farah, in the Pages applicaiton, if you change your language to English and look at the page in question, can you see the attachments in the the Properties > Attachments tab?

0 votesVote for this answer Mark as a Correct answer

Farah El Agha answered on December 4, 2017 17:03

thanks a lot, it turns out that the data was mistakenly displayed and unordered so thats why when I added some data, I couldnt find it in the correct place.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.