Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Datagird format

Datagird format

Scheduled Pinned Locked Moved ASP.NET
question
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    amit__8
    wrote on last edited by
    #1

    How can i format datagrid. i wants to display 5 records per page but if there is only 1 record for display than datagrid consumes same space as previously for 5 records. it looks very bed. how can i eliminate the same. 1 2 3 4 5 page 1.2.3 if there is 1 record than it looks like: 1 page1.2.3 how can i display it in proper format

    M 1 Reply Last reply
    0
    • A amit__8

      How can i format datagrid. i wants to display 5 records per page but if there is only 1 record for display than datagrid consumes same space as previously for 5 records. it looks very bed. how can i eliminate the same. 1 2 3 4 5 page 1.2.3 if there is 1 record than it looks like: 1 page1.2.3 how can i display it in proper format

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Hi there, Am I correct in thinking that you want to remove the paging stuff if there is 1 record in the list? If so, you simply do a checking based on the length of the datasource, then set the DataGrid.AllowPaging property accordingly when you bind the datasource to the control for the first time. For example:

      ...
      bool allowPaging = (list.Count < DataGrid1.PageSize);
      DataGrid1.AllowPaging = allowPaging;

      DataGrid1.DataSource = list;
      DataGrid1.DataBind();
      ...

      A 1 Reply Last reply
      0
      • M minhpc_bk

        Hi there, Am I correct in thinking that you want to remove the paging stuff if there is 1 record in the list? If so, you simply do a checking based on the length of the datasource, then set the DataGrid.AllowPaging property accordingly when you bind the datasource to the control for the first time. For example:

        ...
        bool allowPaging = (list.Count < DataGrid1.PageSize);
        DataGrid1.AllowPaging = allowPaging;

        DataGrid1.DataSource = list;
        DataGrid1.DataBind();
        ...

        A Offline
        A Offline
        amit__8
        wrote on last edited by
        #3

        NO,i would like to know that How can i fix height or width of a cell in datagrid. i wants all cells should have the same width ; height may differ.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups