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
    • Member
      4 point Member
    • nellocon
    • Member since 05-15-2008, 10:15 AM
    • Posts 42

    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
    • Member
      109 point Member
    • BaySoft_Dan
    • Member since 06-02-2006, 10:43 AM
    • Swansea (UK)
    • Posts 17

    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
    • Contributor
      2,298 point Contributor
    • Raggers
    • Member since 02-17-2006, 4:40 PM
    • Germany
    • Posts 388

     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
    • Participant
      1,672 point Participant
    • rajeshthangarasu
    • Member since 03-14-2008, 7:08 AM
    • Chennai, India
    • Posts 254

     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 Technology Specialist (MCTS)
    Microsoft Certified Application Developer (MCAD)
  • Re: Displaying Data in a datagrid

    05-16-2008, 12:37 AM
    Answer
    • Member
      105 point Member
    • ams16
    • Member since 05-12-2008, 9:48 AM
    • Posts 77

     

    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
    • Contributor
      3,068 point Contributor
    • blurearc
    • Member since 04-25-2008, 7:15 AM
    • Mumbai India
    • Posts 537

    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. Consultant I)
    Neudesic
    Hyd'bad
    INDIA
Page 1 of 1 (6 items)