绑定对象成员dataList中的字符串列表

时间:2014-12-11 08:56:56

标签: asp.net listview repeater datalist

我有以下课程:

public class MinistryModel
    {
        public string MinistryName { get; set; }
        public string MinistryMission { get; set; }
        public string MinistryVision { get; set; }
        public string MinistrySpecialities { get; set; }
        public string MinistryUrl { get; set; }
        public List<string> MinistryServices { get; set; }

    }

我希望将此元素绑定到asp.net中的数据列表,因为我可以执行的所有属性&lt;%#Eval(“PropertName”)%&gt;但是当我想分开使用每个部门的部门服务时,我该怎么办?

如果我做&lt;%#Eval(“MinistryServices”)%&gt;我会得到所有的字符串,我希望将它们分开,

ie:我想做这样的事情

<asp:DataList ID="DataListDescriptions" runat="server">
    <HeaderTemplate>
        <div>DataBinder info for Ministry# Description</div>
        <ul id="tab1">
    </HeaderTemplate>
    <ItemTemplate>
        <li class="active">
            <div class="desc-title">specialities</div>
            <p class="gray"><%#Eval("MinistrySpecialities") %></p>
            <div class="desc-title center golden">services</div>
            <div class="center">
                <a class="black" href="<%#Eval("MinistryUrl") %>">
                    <%#Eval("MinistryUrl") %>
                </a>
            </div>
            <asp:DataList ID="MinistryServiesData" runat="server">
                <HeaderTemplate>
                    <ul id="tabs11" class="ministry-services black">
                </HeaderTemplate>
                <ItemTemplate>
                    <li class="">
                        <span class="golden arabic-num"></span>
                        ((HOW CAN I PARSE THIS LIST OF STRING HERE ??)
                    </li>
                </ItemTemplate>
                <FooterTemplate>
                    </ul>
                </FooterTemplate>
            </asp:DataList>
    </ItemTemplate>
    <FooterTemplate>
        </ul>
    </FooterTemplate>
</asp:DataList>

0 个答案:

没有答案