Displaying Data in a datagrid

Last post 05-16-2008 12:45 AM by blurearc. 5 replies.

Sort Posts:

  • Displaying Data in a datagrid

    05-15-2008, 6:24 AM
    • Loading...
    • nellocon
    • Joined on 05-15-2008, 10:15 AM
    • Posts 23

    Hi All,

    I am using a datagrid to display records from my database. I have one datagrid which displays all the records and this works fine. I also have a datagrid which only displays records where location is equal to "belgium", this also works fine. My problem however is that when displaying the belgium records there may only be one or 2 records yet the grid still takes up most of the page where the header and footer is enlarged ridiculously.

    When there are many records that fill the grid it looks fine but when there is only one or 2 it resizes the column as such.

     Could anyone please tell me why this happens??

     Thanks alot for your help!

  • Re: Displaying Data in a datagrid

    05-15-2008, 6:28 AM
    Answer
    • Loading...
    • BaySoft_Dan
    • Joined on 06-02-2006, 10:43 AM
    • Swansea (UK)
    • Posts 12

    Without looking at your code, I can only guess, but please check that you don't have the height of the datagrid set to 100%. At the end of the day, the grid is rendered in HTML as a table. You could look at the SOURCE rather than in the designer, and try searching from "100%" in the datagrid code. Hope this helps.

    We develop a range of solutions using ASP.NET/SQL Server. AgentQuote is a recent example.


    Find your best local estate agent, use agentquote.co.uk.
  • Re: Displaying Data in a datagrid

    05-15-2008, 6:46 AM
    • Loading...
    • Raggers
    • Joined on 02-17-2006, 4:40 PM
    • Germany
    • Posts 387

     It depends on contents in your datagrid cells .Not on size of column heading
     

    If this solves your problem please mark as answer
  • Re: Displaying Data in a datagrid

    05-15-2008, 7:22 AM
    Answer

     Remove any height and width properties from the source code

    <asp:GridView ID="GridView1" runat="server" ShowFooter="True" Height="1px" Width="310px" >
            </asp:GridView>

    Mark as Answer if the post was useful to you

    Rajesh Thangarasu
    Microsoft Certified Professional
  • Re: Displaying Data in a datagrid

    05-16-2008, 12:37 AM
    Answer
    • Loading...
    • ams16
    • Joined on 05-12-2008, 9:48 AM
    • Posts 60

     

    Yea,you might have set some width or colspan properties in the design page.please try removing that.
  • Re: Displaying Data in a datagrid

    05-16-2008, 12:45 AM
    Answer
    • Loading...
    • blurearc
    • Joined on 04-25-2008, 7:15 AM
    • Mumbai India
    • Posts 530

    ahh! this reminds me asp.net 1.1,

    yopu must have streached you grid to some height.

    dot do that. and remove hright's valuew of Datagrid from the propertywindow... it will work fine.. :)

    "Mark as answered if you feel this helps you"
    "Curiosity is Bliss"
    Regards,

    Ravi Kant Srivastava
    (Sr. Software Engineer)
    Connexxions Business
    Mumbai
    INDIA
Page 1 of 1 (6 items)