DataGrid BS 用法
DataGrid 属性解释:
AutoGenerateColumns="False" :是否为数据源的每一个字段自动创建对象。
AllowPaging="True" :是否允许分页。
PageSize="5" :分页的页数。
Code
<asp:DataGrid ID="DataGrid1" runat="server" AutoGenerateColumns="False" Width="600px"
BorderWidth="0px" CellPadding="0" ShowHeader="true" AllowPaging="True" PageSize="5"
Height="180px" GridLines="None" OnItemCommand="DataGrid1_ItemCommand">
<Columns>
<asp:TemplateColumn>
<HeaderTemplate>
<table width="400" border="1" bordercolor="#000000"
cellspacing="0" cellpadding="0" style="border-collapse:collapse">
<tr>
<td width="100">编号</td>
<td width="100">标题</td>
<td width="100">内容</td>
<td width="100">操作</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table width="400" border="1" bordercolor="#000000" cellspacing="0"
cellpadding="0" style="border-collapse:collapse">
<tr>
<td width="100"><%# DataBinder.Eval(Container.DataItem,"Id") %></td>
<td width="100"><%# DataBinder.Eval(Container.DataItem,"Title") %></td>
<td width="100"><%# DataBinder.Eval(Container.DataItem,"LogContext") %></td>
<td width="100">
<asp:Button ID="BtnDelete" runat="server" BackColor="#F3F3F3"
Font-Size="14px" BorderStyle="None" Text="编号值" CommandName="index" ForeColor="#3399FF"
CommandArgument='<%# DataBinder.Eval(Container.DataItem,"Id")%>' />
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
Code


浙公网安备 33010602011771号