1 Replies - 9204 Views - Last Post: 29 January 2013 - 04:16 PM

#1 Xna4life  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 78
  • Joined: 21-February 12

changing from panel to gridview - error with layout

Posted 29 January 2013 - 04:08 AM

Hey guys so where before I was hard coding the panel I wanted to display on screen with:
<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>



which produced, the data in rows.

I then used a GridView with boundField, to pull across the details from the table and display them on sreen..Trouble is i'm having a little difficulty with the layout. I'm using:
<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> 



and this looks like: A table,

I would like to change the table to display as my previous layout, without the table, and each row on top of each other, not beside it, i've tried show column=false and stuff like that, also tried using a panel which cant be done,

Can anyone please advise what attribute i need to edit in order to achieve what I want?

Thank you

Is This A Good Question/Topic? 0
  • +

Replies To: changing from panel to gridview - error with layout

#2 5thWall  Icon User is offline

  • Occasional Member

Reputation: 31
  • View blog
  • Posts: 530
  • Joined: 17-September 08

Re: changing from panel to gridview - error with layout

Posted 29 January 2013 - 04:16 PM

GridView only renders tables, there is not an attribute you can set to get it to render not tables. Your best bet would be to use another control (perhaps something like ListView or repeater?).

To help you find a different control, I'd have to know what affect you were trying to get by switching to GridView. So, what does GridView do that you didn't get in your old way of doing things?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1