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. how to set row/column's height/width in datagrid??

how to set row/column's height/width in datagrid??

Scheduled Pinned Locked Moved ASP.NET
helptutorialquestion
5 Posts 4 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.
  • S Offline
    S Offline
    steven_wong
    wrote on last edited by
    #1

    Hello,everyone: Now i have a datagrid, in which each cell may contain many words. it looks quite ugly because the datagrid automatically make the words vertical displayed. Therefore, i wonder if we could solve it through making all the cells have the same fixed heigh/width??and how could we fix the height/width? i have tried to set it in the property builder, however, it does not work:( Looking forward to ur reply, thanks in advance!

    P T 2 Replies Last reply
    0
    • S steven_wong

      Hello,everyone: Now i have a datagrid, in which each cell may contain many words. it looks quite ugly because the datagrid automatically make the words vertical displayed. Therefore, i wonder if we could solve it through making all the cells have the same fixed heigh/width??and how could we fix the height/width? i have tried to set it in the property builder, however, it does not work:( Looking forward to ur reply, thanks in advance!

      P Offline
      P Offline
      postmaster programmingknowledge com
      wrote on last edited by
      #2

      Try to use PreRender in DataGrid: Private Sub grd_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdDefinitionList.PreRender grd.Columns(1).ItemStyle.Width = Unit.Pixel(24) grd.Columns(2).ItemStyle.Width = Unit.Pixel(24) grd.Columns(3).ItemStyle.Width = Unit.Pixel(24) End Sub =postmaster http://www.programmingknowledge.com/[^]

      V 1 Reply Last reply
      0
      • S steven_wong

        Hello,everyone: Now i have a datagrid, in which each cell may contain many words. it looks quite ugly because the datagrid automatically make the words vertical displayed. Therefore, i wonder if we could solve it through making all the cells have the same fixed heigh/width??and how could we fix the height/width? i have tried to set it in the property builder, however, it does not work:( Looking forward to ur reply, thanks in advance!

        T Offline
        T Offline
        talk2prabir yahoo co in
        wrote on last edited by
        #3

        Hi, U can convert the columns to template column in property builder then set following properties according to your requirement: Thanks, Prabir

        S 1 Reply Last reply
        0
        • T talk2prabir yahoo co in

          Hi, U can convert the columns to template column in property builder then set following properties according to your requirement: Thanks, Prabir

          S Offline
          S Offline
          steven_wong
          wrote on last edited by
          #4

          First of all,thank u all for the replies!:rose: However, i am using databinding like this: I am creating a DataGrid form a DataSet with autogeneratecolumns: dg.DataSource = ds; dg.DataBind(); all the columns are autogenerated, thus, we could not convert a specific column into template column. am i right? looking forward to ur reply;P

          1 Reply Last reply
          0
          • P postmaster programmingknowledge com

            Try to use PreRender in DataGrid: Private Sub grd_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdDefinitionList.PreRender grd.Columns(1).ItemStyle.Width = Unit.Pixel(24) grd.Columns(2).ItemStyle.Width = Unit.Pixel(24) grd.Columns(3).ItemStyle.Width = Unit.Pixel(24) End Sub =postmaster http://www.programmingknowledge.com/[^]

            V Offline
            V Offline
            varun_khanna17
            wrote on last edited by
            #5

            I m using Datagrid with Autogenerated Columns. I want to set width of Autogenerated Columns. I used that Code told by you. But it is giving me error: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index So can u explain me more and sort out this Problem... Any help will be greatly appreciated...........

            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