多个媒体选择器中的多个文件夹Umbraco 7

Multiple Folders in Multiple Media Picker Umbraco 7
2020-10-17
  •  译文(汉语)
  •  原文(英语)

我正在尝试在"Multiple Media Picker"中添加多个文件夹,但是当我循环浏览时,我只会得到一个ID.

多个媒体选择器中的多个文件夹Umbraco 7

这是我用来遍历内容的代码:

 var tabList = Model.Content.GetPropertyValue<string>("containertab").Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse);

是否可以在多个媒体选择器中添加多个文件夹?如何获取每个文件夹的ID?

速聊1:
允许,尝试显示原始字段以检查您是否有多个ID的@ {<p> @ CurrentPage.containertab </ p>}
速聊2:
这样可行.把它放到答案中,这样我就可以结束这个问题.谢谢
解决过程1

允许,尝试显示原始字段以检查您是否有多个ID,例如 1135,1136

@{
<p>@CurrentPage.containertab</p>
}

简单的代码示例:

@if (!string.IsNullOrEmpty(CurrentPage.containertab))
{
    foreach (var x in CurrentPage.containertab.ToString().Split(','))
    {
        var media = Umbraco.Media(int.Parse(x));

    }
}

I'm trying to add multiple folders in a Multiple Media Picker but when i'm looping through it i'm only getting a single ID.

Multiple Folders in Multiple Media Picker Umbraco 7

This is the code i'm using to loop through the content:

 var tabList = Model.Content.GetPropertyValue<string>("containertab").Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse);

Is it allowed to add multiple folders in multiple media picker? How can get the ID of each folder?

Talk1:
It is allowed, try to display the raw field to check you have multiple id's @{ <p>@CurrentPage.containertab</p> }
Talk2:
that works. put it into the answer so I could close this question. thanks
Solutions1

It is allowed, try to display the raw field to check you have multiple id's somethings like 1135,1136

@{
<p>@CurrentPage.containertab</p>
}

Simple code example:

@if (!string.IsNullOrEmpty(CurrentPage.containertab))
{
    foreach (var x in CurrentPage.containertab.ToString().Split(','))
    {
        var media = Umbraco.Media(int.Parse(x));

    }
}
转载于:https://stackoverflow.com/questions/30839014/multiple-folders-in-multiple-media-picker-umbraco-7

本人是.net程序员,因为英语不行,使用工具翻译,希望对有需要的人有所帮助
如果本文质量不好,还请谅解,毕竟这些操作还是比较费时的,英语较好的可以看原文

留言回复
我们只提供高质量资源,素材,源码,坚持 下了就能用 原则,让客户花了钱觉得值
上班时间 : 周一至周五9:00-17:30 期待您的加入