0
我遇到了一個封裝Gridview的問題。 Gridview的源代碼是LinqDataSourceLog_Selecting方法中構建的Linq源代碼。我有一個我想要換行的列,但我猜想由於我如何綁定Gridview,列數總是爲0,所以我不能包裝我沒有的東西。以下是Grid的標記。GridQuery與Linq DataSource自動換行
<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>
非常感謝您的幫助。
非常好。我得到正確數量的列,但是我無法將列依然包裹起來。我試過GridViewLog.HeaderRow.Cells [6] .Wrap = true;但無濟於事。 – Eric 2011-05-10 15:35:56
謝謝。有效.... – Eric 2011-05-10 15:50:10