有一个objectdatasource返回一个自定义对象列表(List(of Book) - 方法名称:GetBooksList)
必须在gridview中显示名称作者和发布者作为标签,并在下拉列表中显示publicationDates .Iam在gridview中显示dropdownlist(publicationDates)中的值时出现问题。
有人能让我知道我失踪的是什么吗?
Public Class Book
Public Name As String
Public Author As String
Public Publisher As String
Public PublicationDates As List(Of String)
End Class
<asp:ObjectDataSource runat="server" SelectMethod="GetBooksList" ID="objBooks" TypeName="TestData">
<asp:GridView runat="server" ID="gvResults" DataSourceID="objBooks" >
<Columns>
<asp:BoundField DataField="Name" HeaderText="Book Name" ReadOnly="True" >
<HeaderStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="Author" HeaderText="Author" ReadOnly="True" >
<HeaderStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="Publisher" HeaderText="Publisher" ReadOnly="True" >
<HeaderStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:TemplateField HeaderText="Publication Dates" >
<ItemTemplate>
<asp:DropDownList runat="server" ID="ddPublicationDates" DataSourceID="objBooks" DataTextField ="PublicationDates" >
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>