1

我有WCF Service一个方法,它List of strings基本上返回作者的姓名,我想将此数据源映射到FormView但是我得到以下输出System.String[],因为有多个作者。

我怎么知道FormView在字符串中取 List 和 group 元素,

    [DataContract]
public class PublicationDetail
{
    [DataMember]
    public string PubID { get; set; }
    [DataMember]
    public string Title { get; set; }
    [DataMember]
    public List<string> Authors { get; set; }
    [DataMember]
    public string Description { get; set; }
    [DataMember]
    public string Publisher { get; set; }
    [DataMember]
    public DateTime PubDate { get; set; }
}



        <ItemTemplate>
            ExtensionData:
            <asp:Label ID="ExtensionDataLabel" runat="server" Text='<%# Bind("ExtensionData") %>' />
            <br />
            Authors:
            <asp:Label ID="AuthorsLabel" runat="server" Text='<%# Bind("Authors") %>' />
            <br />
            Description:
            <asp:Label ID="DescriptionLabel" runat="server" Text='<%# Bind("Description") %>' />
            <br />
            PubDate:
            <asp:Label ID="PubDateLabel" runat="server" Text='<%# Bind("PubDate") %>' />
            <br />
            PubID:
            <asp:Label ID="PubIDLabel" runat="server" Text='<%# Bind("PubID") %>' />
            <br />
            Publisher:
            <asp:Label ID="PublisherLabel" runat="server" Text='<%# Bind("Publisher") %>' />
            <br />
            Title:
            <asp:Label ID="TitleLabel" runat="server" Text='<%# Bind("Title") %>' />
            <br />

        </ItemTemplate>
4

1 回答 1

2

更改您的陈述如下:

Authors:
<asp:Panel ID="pnAddTransition" runat="server" Visible="false">
    <asp:Label ID="AuthorsLabel" runat="server" Text='<%# String.Join( ",", ((List<string>)Eval("Authors")).ToArray()) %>' />
<br />
于 2013-01-12T17:41:12.400 回答