【发布时间】:2011-05-10 15:12:36
【问题描述】:
我遇到了 Gridview 自动换行的问题。 Gridview 的源是在 LinqDataSourceLog_Selecting 方法中构建的 Linq 源。我有一列我想自动换行,但我想由于我绑定 Gridview 的方式,列数始终为 0,所以我无法换行我没有的东西。以下是 Grid 的标记。
<asp:GridView ID="GridViewLog" Width="200px" runat="server" CellPadding="4" AllowPaging="true"
DataSourceID="LinqDataSourceLog" ShowHeader="true" AllowSorting="true" OnPageIndexChanging="GridViewLog_PageIndexChanging"
EnableModelValidation="True" AutoGenerateColumns="true" ForeColor="#333333" GridLines="Both"
Height="164px" OnRowDataBound="GridViewLog_RowDataBound" RowStyle-Wrap="true" AlternatingRowStyle-Wrap="true"
PageSize="10" PagerSettings-Mode="Numeric" OnPreRender="GridViewLog_Prerender">
<EmptyDataTemplate>
<table>
<tr>
<td style="color: #003366">
<strong>Either the applied filter returned no results or<br />
the Out of office log is currently empty .</strong>
</td>
</tr>
</table>
</EmptyDataTemplate>
<AlternatingRowStyle BackColor="White" Wrap="false" />
<EditRowStyle BackColor="#2461BF" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" CssClass="pagination" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#EFF3FB" Wrap="false" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
</asp:GridView>
提前感谢您的帮助。
【问题讨论】:
标签: c# asp.net visual-studio linq gridview