0
如何在列表视图中使用列表视图? 我有一个项目列表,每个项目都有一个标签列表。列表视图中的列表视图问题
<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1">
<LayoutTemplate>
<ul>
<asp:PlaceHolder ID="itemPlaceholder" runat="server" />
</ul>
</LayoutTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#Eval("title")%>'></asp:Label>
<asp:ListView ID="ListView2" runat="server"
DataSource='<%#getTagDatasource((string)Eval("tags"))%>'>
<LayoutTemplate>
<ul>
<asp:PlaceHolder ID="itemPlaceholder" runat="server" />
</ul>
</LayoutTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%#Container.DataItem%>'></asp:Label></div>
</ItemTemplate>
</asp:ListView>
</ItemTemplate>
</asp:ListView>
用于第二列表视图数据源是包含的包含在标记列标签阵列(一个字符串数组是一个字符串分隔机智一个“”。数据源串阵列I形成在getTagDatasource方法与一个tags.split(','))在表中。
现在,这并不工作,因为它说无法投类型的对象'System.DBNull为键入“System.String”。
有没有人对我的问题的解决方案?