【问题标题】:am try to use thead and tbody with gridview in asp.net我尝试在 asp.net 中使用带有 gridview 的 thead 和 tbody
【发布时间】:2015-03-28 11:37:25
【问题描述】:

我想知道如何在 asp.net 的 gridview 中使用 thead 和 tbody,而我的 html 正在尝试添加由 DataTables 呈现的页面控件我必须将 thead 和 tbody 与数据表一起使用,但在 gridview 中我不知道如何或者我必须把thead和tbody放在哪里,因为在gridview中有boundfield包括数据字段和标题文本

这是带有链接的模板字段

                                     <asp:TemplateField HeaderText="تعديل"> 
                                <ItemTemplate>
                                    <asp:LinkButton ID="LinkButton2" runat="server" CommandName="EditRecored" CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>' >تعديل</asp:LinkButton>
                                </ItemTemplate>
                                </asp:TemplateField>

这里是绑定字段,包括标题文本和数据字段

                                   <asp:BoundField  DataField="Phone" 
                                HeaderText="رقم الهاتف " ItemStyle-Font-Size="Small">

                            <asp:BoundField  DataField="AddressEn" 
                                HeaderText="العنوان انجليزي" ItemStyle-Font-Size="Small">

                                       <asp:BoundField  DataField="NameEn" 
                                HeaderText="اسم الحساب انجليزي" ItemStyle-Font-Size="Small">

                                <asp:BoundField  DataField="ledgerCode" 
                                HeaderText="رقم الحساب الرئيسي" ItemStyle-Font-Size="Small">

                 </Columns>
                           <RowStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
                           <AlternatingRowStyle BackColor="#DDDDDD" />
                           <FooterStyle BackColor="#CCCCCC" />
                           <HeaderStyle BackColor="#aaaaaa" Font-Bold="True" HorizontalAlign="Center" 
                               VerticalAlign="Middle" ForeColor="Black" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px"/>

                       </asp:GridView>

【问题讨论】:

    标签: html css asp.net gridview


    【解决方案1】:

    要添加thead 和tbody 元素试试这个:

     GridView1.HeaderRow.TableSection = TableRowSection.TableHeader;
     GridView1.HeaderRow.CssClass = "yourClassName";
    

    【讨论】:

      猜你喜欢
      • 2010-10-08
      • 2011-03-20
      • 2011-04-30
      • 2010-11-11
      • 2011-02-22
      • 1970-01-01
      • 2019-04-06
      • 2010-11-23
      • 1970-01-01
      相关资源
      最近更新 更多