如何在HTML表格中编写网格视图? [英] how to write grid view in html table?
问题描述
我有这个网格视图,我想把它写成html表格,但我不知道
是如何写入(table,thead,td和tr)标签的。我想知道如何在html表格中编写它。
I have this grid view and I want to write it as html table but I don't know how I want to write it in ( table ,thead, td and tr ) tags . I want to know how to write it in html table
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" EnableSortingAndPagingCallbacks="false"
BackColor="White" BorderColor="#999999"
ViewStateMode="Enabled" width="713px" CellPadding="3"
HorizontalAlign="Center" AllowSorting="True" OnPageIndexChanging="GridView1_PageIndexChanging"
BorderStyle="Solid" BorderWidth="1px" ForeColor="Black" ShowFooter="True"
GridLines="Vertical" AutoGenerateColumns="False" PageSize="20" onrowdatabound="GridView1_RowDataBound"
Height="16px" >
<Columns>
<asp:TemplateField HeaderText="الرصيد">
<ItemTemplate>
<asp:Label runat="server" ID="lblTotal" Text=""></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="مدين">
<ItemTemplate>
<div style="padding:0 0 5px 0"> <asp:Label ID="debit" runat="server" Text='<%# (Eval("stat_flag").ToString() =="d" ) ? string.Format("{0:0.000}",float.Parse(Eval("stat_amount").ToString())): "0.00" %>'></asp:Label></div>
<div><asp:Label ID="lblGrandTotal" runat="server" /></div>
</ItemTemplate>
<FooterTemplate>
<asp:Label ID="totallblDebAmount" runat="server" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="دائن">
<ItemTemplate>
<div style="padding:0 0 5px 0"><asp:Label ID="credit"
runat="server" Text='<%# (Eval("stat_flag").ToString() =="c" ) ?
string.Format("{0:0.000}",float.Parse(Eval("stat_amount").ToString())):
"0.00" %>'></asp:Label></div>
</ItemTemplate>
<FooterTemplate>
<asp:Label ID="totallblCredAmount" runat="server" />
</FooterTemplate>
</asp:TemplateField>
<asp:BoundField DataField="stat_desc"
HeaderText="البيان" ItemStyle-Font-
Size="Small">
<ItemStyle Font-Size="Small"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="trans_name"
HeaderText=" نوع السند " ItemStyle-Font-
Size="Small">
<ItemStyle Font-Size="Small"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="serial"
HeaderText=" رقم السند " ItemStyle-Font-
Size="Small">
<ItemStyle Font-Size="Small"></ItemStyle>
</asp:BoundField>
<asp:TemplateField HeaderText="التاريخ">
<ItemTemplate>
<asp:Label ID="date" runat="server" Text='<%#Eval("stat_date" ,"{0:dd/MM/yyyy}" )%>'> ></asp:Label>
</ItemTemplate>
<FooterTemplate>
<div style="padding:0 0 5px 0"><asp:Label ID="Label5" Text="اجمالي الصفحة
" runat="server" /></div>
</FooterTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#336699" Font-
Bold="True" ForeColor="White" HorizontalAlign="right" />
<RowStyle BorderColor="Black" BorderStyle="Solid"
BorderWidth="1px" />
<AlternatingRowStyle BackColor="#DDDDDD" />
<HeaderStyle BackColor="#aaaaaa" Font-Bold="True"
HorizontalAlign="Center"
VerticalAlign="Middle" ForeColor="Black"
BorderColor="Black" BorderStyle="Solid" BorderWidth="1px"/>
<PagerStyle BackColor="#999999" ForeColor="Blue"
HorizontalAlign="Left" Font-Bold="True"
Font-Underline="False" BorderStyle="Solid"
BorderWidth="1px" BorderColor="#666666" />
</asp:GridView>
举例我想用这种格式的html格式编写它。
for an example I want to write it in html format like this format
<TABLE CELLPADDING=6>
<THEAD>
<TR> <TH>Weekday</TH> <TH>Date</TH> <TH>Manager</TH> <TH>Qty</TH> </TR>
</THEAD>
<TBODY>
<TR> <TD>Mon</TD> <TD>09/11</TD> <TD>Kelsey</TD> <TD>639</TD> </TR>
<TR> <TD>Tue</TD> <TD>09/12</TD> <TD>Lindsey</TD> <TD>596</TD> </TR>
<TR> <TD>Wed</TD> <TD>09/13</TD> <TD>Randy</TD> <TD>1135</TD> </TR>
<TR> <TD>Thu</TD> <TD>09/14</TD> <TD>Susan</TD> <TD>1002</TD> </TR>
<TR> <TD>Fri</TD> <TD>09/15</TD> <TD>Randy</TD> <TD>908</TD> </TR>
<TR> <TD>Sat</TD> <TD>09/16</TD> <TD>Lindsey</TD> <TD>371</TD> </TR>
<TR> <TD>Sun</TD> <TD>09/17</TD> <TD>Susan</TD> <TD>272</TD> </TR>
</TBODY>
<TFOOT id="table_footer">
<TR> <TH ALIGN=LEFT COLSPAN=3>Total</TH> <TH>4923</TH> </TR>
</TFOOT>
</TABLE>
</body>
</html>
推荐答案
也许你可以创建你的GridView,运行你的项目,然后右键单击浏览器屏幕并检查元素。然后,你会看到生成的Html代码。
Maybe you could create your GridView, run your project and then right click on the browser screen and Inspect Element. Then, you will see the generated Html code.
或者你可以访问这个网站,它有一个可以帮助你的例子:使用ASP.Net将GridView导出为HTML文件C# a>。
Or you can visit this website that has an example that can help you: Export Gridview To HTML File Using ASP.Net C#.
这篇关于如何在HTML表格中编写网格视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!