部分代码如下:
<asp:DataList ID="DataList1" runat="server" CellPadding="4" ForeColor="#333333"
Style="position: relative; left: 0px; top: -14px;" Width="100%" BackColor="White" CaptionAlign="Left" ShowFooter="false" ShowHeader="False">
<ItemTemplate>
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%; position: relative;
height: 125%">
<tr>
<td style="height: 88px; width: 233%;" valign="top">
<asp:DataGrid ID="DataGrid1" runat="server" AutoGenerateColumns="False" CellPadding="4"
ForeColor="#333333" Height="100%" Style="position: relative; left: 0px; top: 0px;"
Width="100%" DataKeyField="ID" DataSource='<%# ((System.Data.DataRowView)Container.DataItem).CreateChildView("CategoryForum") %>' OnItemDataBound="DataGrid1_ItemDataBound">
<Columns>
</Columns>
</asp:DataGrid>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList> </div>我在Page_Load里已经间DataList1绑定到数据源了,嵌套的DataGrid也用语句DataSource='<%# ((System.Data.DataRowView)Container.DataItem).CreateChildView("CategoryForum") %>'进行了嵌套的数据绑定,但现在想间DataGrid的HeaderTemplate绑定到数据库,如果直接在HeaderTemplate里进行绑定是不行的,请问有什么方法呢?另外,在DataGrid1_ItemDataBound里也没办法访问DataGrid1绑定的数据,请大侠解惑,谢谢!
<asp:DataList ID="DataList1" runat="server" CellPadding="4" ForeColor="#333333"
Style="position: relative; left: 0px; top: -14px;" Width="100%" BackColor="White" CaptionAlign="Left" ShowFooter="false" ShowHeader="False">
<ItemTemplate>
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%; position: relative;
height: 125%">
<tr>
<td style="height: 88px; width: 233%;" valign="top">
<asp:DataGrid ID="DataGrid1" runat="server" AutoGenerateColumns="False" CellPadding="4"
ForeColor="#333333" Height="100%" Style="position: relative; left: 0px; top: 0px;"
Width="100%" DataKeyField="ID" DataSource='<%# ((System.Data.DataRowView)Container.DataItem).CreateChildView("CategoryForum") %>' OnItemDataBound="DataGrid1_ItemDataBound">
<Columns>
</Columns>
</asp:DataGrid>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList> </div>我在Page_Load里已经间DataList1绑定到数据源了,嵌套的DataGrid也用语句DataSource='<%# ((System.Data.DataRowView)Container.DataItem).CreateChildView("CategoryForum") %>'进行了嵌套的数据绑定,但现在想间DataGrid的HeaderTemplate绑定到数据库,如果直接在HeaderTemplate里进行绑定是不行的,请问有什么方法呢?另外,在DataGrid1_ItemDataBound里也没办法访问DataGrid1绑定的数据,请大侠解惑,谢谢!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货