Asp.net 从面板更改为gridview-布局错误
嘿,伙计们,在我硬编码面板之前,我想在屏幕上显示:Asp.net 从面板更改为gridview-布局错误,asp.net,gridview,panel,databound,Asp.net,Gridview,Panel,Databound,嘿,伙计们,在我硬编码面板之前,我想在屏幕上显示: <asp:Panel ID="Panel1" runat="server" CssClass="PrintHeader" HorizontalAlign="Center"> <div style="margin-left:10px;margin-bottom:10px;text-align:center;"> <span style="font
<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>
建筑合同
利物浦蒙布洛克上路317号,某某BT70 6HJ
发票编号:
付款计量
V.A.T.第85119123号
产生了:
然后我使用了一个带有boundField的GridView,从表中拖出细节并在sreen上显示。问题是我在布局上有点困难。
我正在使用:
<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之类的东西,还尝试过使用无法完成的面板
有人能告诉我需要编辑什么属性才能实现我想要的吗
多谢各位
编辑:
谢谢大家的回复,我试过转发器:
因此:
然后在代码隐藏中:
ClarkeDBDataContext db = new ClarkeDBDataContext();
invoice_Info =
(from invoiceInfo in db.Invoice_Infos
select invoiceInfo).FirstOrDefault();
Header.DataBind();
The page displays: <%Eval("invoice_Info")%>
ClarkeDBDataContext db=new ClarkeDBDataContext();
发票信息=
(来自db.Invoice\u Infos中的invoiceInfo)
选择invoiceInfo).FirstOrDefault();
Header.DataBind();
该页面显示:
有人能告诉我哪里出了问题吗
谢谢你
<asp:GridView ID="grdid" runat="server" AutoGenerateColumns="false" EmptyDataText="No records" ShowHeader="false">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<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: <%#Eval("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>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
建筑合同
利物浦蒙布洛克上路317号,某某BT70 6HJ
发票编号:
付款计量
V.A.T.第85119123号
以这种方式使用代码。
使用适当的列值绑定网格。代替
使用在Griview中有一个列,绑定数据,并为模板字段指定ItemStyle HorizontalAlign=“Center”,并将Gridview边界设置为0,希望您将获得以前的格式。为此,尝试了它,但没有效果
<asp:GridView ID="grdid" runat="server" AutoGenerateColumns="false" EmptyDataText="No records" ShowHeader="false">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<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: <%#Eval("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>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>