嘿伙计们,在我对面板进行硬编码之前,我想在屏幕上显示:
<asp:Panel ID="Panel1" runat="server" CssClass="PrintHeader" HorizontalAlign="Center">
<div style="margin-left:10px;margin-bottom:10px;text-align:center;">
<span style="font-size:22px;border-bottom:double 1px black">Construction Contracts</span><br /><br />
<span style="font-size:12px;">317 Upper Road, Mountblock, Liverpool, Co. Such&Such BT70 6HJ</span><br /><br />
<span style="font-size:16px;">Invoice Number: <%: this.CurrentInvoiceName %></span><br />
<span style="font-size:16px;">MEASUREMENT FOR PAYMENT</span><br />
<span style="font-size:12px;">V.A.T. No. 851 119 123</span>
</div>
</asp:Panel>
产生: 然后我使用带有boundField的GridView,从表格中提取详细信息并将它们显示在屏幕上。问题是我的布局有点困难。我在用着:
<asp:GridView ID="GridView1" CssClass="PrintHeader" HorizontalAlign="Center" runat="server" Width="100px" AllowSorting="true" AutoGenerateColumns="false" DataSourceID="GridDataSource">
<Columns>
<asp:BoundField DataField="id" HeaderText="InvoiceInfoID" ReadOnly="True" SortExpression="InvoiceInfoID" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" />
<asp:BoundField DataField="County" HeaderText="County" SortExpression="County" />
<asp:BoundField DataField="Postcode" HeaderText="Postcode" SortExpression="Postcode" />
<asp:BoundField DataField="Invoice Number" HeaderText="Invoice Number" SortExpression="Invoice Number"/>
<asp:BoundField DataField="Info" HeaderText="Info" SortExpression="Info" />
<asp:BoundField DataField="VAT Number" HeaderText="VAT Number" SortExpression="VAT Number"/>
</Columns>
<PagerStyle CssClass="footer"/>
<PagerTemplate>
<asp:GridViewPager runat="server" />
</PagerTemplate>
<EmptyDataTemplate>
There are currently no details to display.
</EmptyDataTemplate>
</asp:GridView>
<asp:SqlDataSource ID="GridDataSource" runat="server"
ConnectionString="<%$ConnectionStrings:ClarkesTest4FromMaster1ConnectionString %>"
SelectCommand="SELECT id, [Name], [Address], [County], [Postcode], [Invoice Number], [Info], [VAT Number] FROM [Invoice Info] ORDER BY [Name]" >
</asp:SqlDataSource>
这看起来像:
我想更改表格以显示为我以前的布局,没有表格,并且每一行都在彼此之上,而不是在它旁边,我尝试过 show column=false 之类的东西,也尝试过使用面板做不到,
谁能告诉我需要编辑什么属性才能实现我想要的?
谢谢
编辑:感谢所有我试过中继器的人的回复:
所以:
<asp:Panel ID="Panel2" runat="server" CssClass="PrintHeader" HorizontalAlign="Center">
<asp:Repeater ID="InvoiceHeader" DataSourceID="GridDataSource" runat="server">
<ItemTemplate>
<asp:Label ID="Name" runat="server" Text='<%Eval("invoice_Info")%>'> </asp:Label>
</tr>
</td>
</ItemTemplate>
</asp:Repeater>
</asp:Panel>
<asp:SqlDataSource ID="GridDataSource" runat="server"
ConnectionString="<%$ConnectionStrings:ClarkesTest4FromMaster1ConnectionString %>"
SelectCommand="SELECT id, [Name], [Address], [County], [Postcode], [Invoice Number], [Info], [VAT Number] FROM [Invoice Info] ORDER BY [Name]" >
</asp:SqlDataSource>
然后在后面的代码中:
ClarkeDBDataContext db = new ClarkeDBDataContext();
invoice_Info =
(from invoiceInfo in db.Invoice_Infos
select invoiceInfo).FirstOrDefault();
Header.DataBind();
The page displays: <%Eval("invoice_Info")%>
有人可以告诉我哪里出错了吗?
谢谢你