我是一名新的 ASP.NET 开发人员,我正在努力解决一个我不知道如何解决的奇怪问题。我正在开发一个基于 Web 的小型事件管理系统。这些事件将在 GridView 中列出。现在,我正在寻找一种方法来突出显示该事件或在它旁边放置一个符号,当预订数量达到该事件的座位数时,它会显示(关闭)。怎么做?
我有以下数据库设计:
Events Table: ID, Title, Description, Location, StartDateTime, EndDateTime, NumberOfSeats, IsActive
BookingDetails Table: BookingID, EventID, NetworkID
(IsActive 是一个标志,显示事件是否仍处于活动状态或变为非活动状态)
我的 ASP.NET 代码:
<asp:GridView ID="ListOfAvailableEvents_GrivView" runat="server" AutoGenerateColumns="False"
DataKeyNames="ID" CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333"
GridLines="None" AllowPaging="True" PageSize="10">
<Columns>
<asp:TemplateField HeaderText="Title">
<ItemTemplate>
<asp:LinkButton ID="lnkTitle" runat="server" Text='<%# Eval("Title") %>' OnClick="lnkTitle_Click"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
<asp:BoundField DataField="Location" HeaderText="Location" SortExpression="Location" />
<asp:BoundField DataField="StartDateTime" HeaderText="Start Date & Time" SortExpression="StartDateTime" />
<asp:BoundField DataField="EndDateTime" HeaderText="End Date & Time" SortExpression="EndDateTime" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:PM_RegistrationSysDBConnectionString %>"
SelectCommand="SELECT ID, Title, Description, Location, StartDateTime, EndDateTime
FROM dbo.Events
WHERE (IsActive = 1)
ORDER BY ID DESC"></asp:SqlDataSource>