天天看点

【转】GridView生成的HTML代码

    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" CssClass="tablecss" > 

        <Columns> 

            <asp:TemplateField HeaderText="编号" HeaderStyle-CssClass="aaa"  ItemStyle-CssClass="bbb" > 

                <ItemTemplate> 

                    <%#Eval("id") %> 

                </ItemTemplate> 

            </asp:TemplateField> 

            <asp:TemplateField HeaderText="姓名" HeaderStyle-CssClass="aaa" ItemStyle-CssClass="bbb"> 

                <ItemTemplate> 

                    <%#Eval("name") %> 

                </ItemTemplate> 

            </asp:TemplateField> 

        </Columns> 

    </asp:GridView> 

↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 

   <div> 

        <table class="tablecss"  cellspacing="0" rules="all" id="Table1" style="border-collapse: collapse;"> 

            <tr> 

                <th class="aaa"  scope="col">编号</th> 

                <th class="aaa"  scope="col">姓名</th> 

            </tr> 

            <tr> 

                <td class="bbb" >1</td> 

                <td class="bbb" >张三</td> 

            </tr> 

            <tr> 

                <td class="bbb" >2</td> 

                <td class="bbb" >李四</td> 

            </tr> 

        </table> 

    </div>

继续阅读