我是使用中继器以及 Datalist 的新手。
我在论坛中检查了将数据列表放置在中继器中的正确方法。下面是我创建的,但它只在我运行时显示转发器的标题
<div id="divMarketSnapshot" style="vertical-align: central; width: 100%; height: 450px; overflow: auto" runat="server">
<asp:Repeater ID="rptrRanks" runat="server" ViewStateMode="Disabled">
<HeaderTemplate>
<table border="0" style="border-collapse: collapse; table-layout: fixed; width:100%;vertical-align:central">
<tr style="height: 14pt; width:100%">
<td class="xl6220798" colspan="33" style="text-align: left; font-weight: bold;width:99.99%"></td>
</tr>
<tr style="height: 14pt; width:100%">
<td class="xl1520798" style="width:3.03%"></td>
<td class="xl1520798" style="width:3.03%"></td>
<td class="xl1520798" style="width:3.03%"></td>
<td class="xl1520798" colspan="27" style="text-align: left;font-size:14pt; font-weight: bold;width:81.1%"><%# DataBinder.Eval(Container.DataItem, "EventRow_Group") %></td>
<td class="xl1520798" style="width:3.03%"></td>
<td class="xl1520798" style="width:3.03%"></td>
<td class="xl1520798" style="width:3.03%"></td>
</tr>
<tr style="height: 14pt; width:100%">
<td class="xl6220798" colspan="33" style="text-align: left; font-weight: bold;width:99.99%"></td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<asp:DataList ID="dlRanks" runat="server" RepeatColumns="2" RepeatDirection="Horizontal">
<HeaderTemplate>
<tr style="height: 14pt; width:100%" runat="server">
<td runat="server" colspan="16" class="xl6620798" style="width:48.48%">
<a href="<%# DataBinder.Eval(Container.DataItem, "EventRow_ChartLink") %>" " title="<%# DataBinder.Eval(Container.DataItem, "EventRow_EventDirectionDesc") %>" target="_blank"><%# DataBinder.Eval(Container.DataItem, "EventRow_Name") %></a>
</td>
<td class="xl1520798" style="width:3.03%"></td>
</tr>
<tr runat="server" style="width: 100%">
<td class="xl6720798" colspan="2" style="width: 6.06%; text-align: center">Date</td>
<td class="xl6720798" colspan="2" style="width: 6.06%; text-align: center">Market<br />Forecast</td>
<td class="xl6820798" colspan="2" style="width: 6.06%; text-align: center">RCG<br />Forecast</td>
<td class="xl6920798" colspan="2" style="width: 6.06%; text-align: center">Market<br />Actual</td>
<td class="xl7020798" colspan="2" style="width: 6.06%; text-align: center">RCG<br />Accuracy</td>
<td class="xl6920798" colspan="2" style="width: 6.06%; text-align: center">Equity Market<br />End Of Day</td>
<td class="xl7020798" colspan="2" style="width: 6.06%; text-align: center"><%# DataBinder.Eval(Container.DataItem, "EventRow_IndexHeader") %> Index<br />End Of Day</td>
<td class="xl7020798" colspan="2" style="width: 6.06%; text-align: center"><%# DataBinder.Eval(Container.DataItem, "EventRow_CurrencyHeader") %><br />End Of Day</td>
<td class="xl1520798" style="width: 3.03%"></td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="width:100%">
<td class="xl7120798" colspan="2" style="width:6.06%; text-align: center"><%# DataBinder.Eval(Container.DataItem, "EventRow_DateTime") %></td>
<td class="xl7120798" colspan="2" style="width:6.06%; text-align: center"><%# DataBinder.Eval(Container.DataItem, "EventRow_Forecast") %></td>
<td class="<%# DataBinder.Eval(Container.DataItem, "EventRow_ForecastDirection_Change") %>" colspan="2" style="width:6.06%; text-align: center"><%# DataBinder.Eval(Container.DataItem, "EventRow_ForecastDirection") %></td>
<td class="xl7120798" colspan="2" style="width:6.06%; text-align: center"><%# DataBinder.Eval(Container.DataItem, "EventRow_Actuals") %></td>
<td class="<%# DataBinder.Eval(Container.DataItem, "EventRow_ActualMarketResult_Font") %>" colspan="2" style="width:6.06%; text-align: center"><%# DataBinder.Eval(Container.DataItem, "EventRow_ActualMarketResult") %></td>
<td class="<%# DataBinder.Eval(Container.DataItem, "EventRow_Equity_EOD_Change") %>" colspan="2" style="width:6.06%; text-align: center"><%# DataBinder.Eval(Container.DataItem, "EventRow_Equity_EOD_Price") %></td>
<td class="<%# DataBinder.Eval(Container.DataItem, "EventRow_Index_EOD_Change") %>" colspan="2" style="width:6.06%; text-align: center"><%# DataBinder.Eval(Container.DataItem, "EventRow_Index_EOD_Price") %></td>
<td class="<%# DataBinder.Eval(Container.DataItem, "EventRow_Currency_EOD_Change") %>" colspan="2" style="width:6.06%; text-align: center"><%# DataBinder.Eval(Container.DataItem, "EventRow_Currency_EOD_Price") %></td>
<td class="xl1520798" style="width:3.03%"></td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr style="width:100%">
<td style="width:3.03%"></td>
<td style="width:3.03%"></td>
<td class="xl1520798_15" colspan="4" style="width:12.12%; text-align: left">Next Forecast: <%# DataBinder.Eval(Container.DataItem, "EventRow_NextForecast") %></td>
<td style="width:3.03%"></td>
<td class="xl1520798_15" colspan="3" style="width:12.3%;text-align:center">Ultra Accuracy: <span style="<%# DataBinder.Eval(Container.DataItem, "EventRow_UltraAccuracy_Style") %>"><%# DataBinder.Eval(Container.DataItem, "EventRow_UltraAccuracy") %></td>
<td colspan="7" style="width:21.21%"></td>
</tr>
<tr style = "width:100%">
<td class="xl6820798" colspan="33" style="width:99.99%"></td>
</tr>
</FooterTemplate>
</asp:DataList>
</table>
</ItemTemplate>
ItemDatabound 上的代码隐藏:
Private Sub rptrRanks_ItemDataBound(sender As Object, e As RepeaterItemEventArgs) Handles rptrRanks.ItemDataBound
Dim dt As DataTable
Dim dlRanks As DataList = DirectCast(e.Item.FindControl("dlRanks"), DataList)
dt = TryCast(rptrRanks.DataSource, DataTable)
dlRanks.DataSource = dt
dlRanks.DataBind()
End Sub
对于 Datalist,我有 2 列数据。我正在寻找的结构如下:
Group
Event Event
data col data col data col data col data col data col
data col data col data col data col data col data col
data col data col data col data col data col data col
data col data col data col data col data col data col
Footer information Footer information
请让我知道我需要更改哪些内容才能正常工作。