Asp.Net将GridView呈现给表

时间:2015-03-11 10:53:07

标签: c# asp.net gridview

我应该在我的网页上向用户显示表格信息。我使用GridView:

    <asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <asp:GridView Id="report2_gridView" runat="server" HeaderStyle-BackColor="#3AC0F2" HeaderStyle-ForeColor="White"
                                  ShowHeaderWhenEmpty="true" AutoGenerateColumns="false">
                        <Columns>
                            <asp:BoundField DataField="CommutatorIp"             HeaderText="Commutator"                                        ItemStyle-Width="150" />
                            <asp:BoundField DataField="SomeData1"                        HeaderText="SomeData1"                                           ItemStyle-Width="150" />
                            <asp:BoundField DataField="SomeData2"                                HeaderText="SomeData2"                                    ItemStyle-Width="150" />
                            <asp:BoundField DataField="SomeData3"                              HeaderText="SomeData3"                                    ItemStyle-Width="150" />
                            <asp:BoundField DataField="SomeData4"                               HeaderText="SomeData4"                                      ItemStyle-Width="150" />
                        </Columns>
                    </asp:GridView>

</asp:Content>

但是当浏览器渲染我的页面时,GridView转换为:

<div>
    <table cellspacing="0" rules="all" border="1" id="MainContent_report2_gridView" style="border-collapse:collapse;">
        <tbody><tr style="color:White;background-color:#3AC0F2;">
            <th scope="col">Commutator</th><th scope="col">SomeData1</th><th scope="col">SomeData2</th><th scope="col">SomeData3</th><th scope="col">SomeData4</th>
        </tr><tr>
            <td style="width:150px;">1.1.1.1</td><td style="width:150px;">1somedata1</td><td style="width:150px;">1somedata2</td><td style="width:150px;">1somedata3</td><td style="width:150px;">1somedata4</td>
        </tr><tr>
            <td style="width:150px;">2.2.2.2</td><td style="width:150px;">2somedata1</td><td style="width:150px;">2somedata2</td><td style="width:150px;">2somedata3</td><td style="width:150px;">2somedata4</td>
        </tr><tr>
            <td style="width:150px;">3.3.3.3</td><td style="width:150px;">3somedata1</td><td style="width:150px;">3somedata2</td><td style="width:150px;">3somedata3</td><td style="width:150px;">3somedata4</td>
        </tr><tr>
            <td style="width:150px;">1.1.1.1</td><td style="width:150px;">mega</td><td style="width:150px;">mega2</td><td style="width:150px;">mega3</td><td style="width:150px;">mega4</td>
        </tr>
    </tbody></table>
</div>

一切都很好,但我不需要div元素!如何将GridView转换为没有div的表?

0 个答案:

没有答案