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. Datagrid

Datagrid

Scheduled Pinned Locked Moved ASP.NET
11 Posts 3 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
    A kamath
    wrote on last edited by
    #1

    I want to keep each feild in particular width. How should I do this. I set width property , but not working

    D 1 Reply Last reply
    0
    • A A kamath

      I want to keep each feild in particular width. How should I do this. I set width property , but not working

      D Offline
      D Offline
      Deepml
      wrote on last edited by
      #2

      Set width of ItemStyle,

      A 1 Reply Last reply
      0
      • D Deepml

        Set width of ItemStyle,

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

        Thanks.It is not working

        C 1 Reply Last reply
        0
        • A A kamath

          Thanks.It is not working

          C Offline
          C Offline
          Chetan Ranpariya
          wrote on last edited by
          #4

          Hi, Can u tell us exactly how u r setting the width of columns in the datagrid? Thanks and Regards, Chetan Ranpariya

          A 1 Reply Last reply
          0
          • C Chetan Ranpariya

            Hi, Can u tell us exactly how u r setting the width of columns in the datagrid? Thanks and Regards, Chetan Ranpariya

            A Offline
            A Offline
            A kamath
            wrote on last edited by
            #5

            The text has come to the width which I set now but the column width has not changed.

            C 1 Reply Last reply
            0
            • A A kamath

              The text has come to the width which I set now but the column width has not changed.

              C Offline
              C Offline
              Chetan Ranpariya
              wrote on last edited by
              #6

              Hi, Not getting the problem. You want your columns to be with fixed width or u want them to be resize as per the length of content?

              Thanks and Regards, Chetan Ranpariya

              A 1 Reply Last reply
              0
              • C Chetan Ranpariya

                Hi, Not getting the problem. You want your columns to be with fixed width or u want them to be resize as per the length of content?

                Thanks and Regards, Chetan Ranpariya

                A Offline
                A Offline
                A kamath
                wrote on last edited by
                #7

                I have a description column in my data grid. In the datagrid I don't want to show full description. only I want to show full description in details view.

                C 1 Reply Last reply
                0
                • A A kamath

                  I have a description column in my data grid. In the datagrid I don't want to show full description. only I want to show full description in details view.

                  C Offline
                  C Offline
                  Chetan Ranpariya
                  wrote on last edited by
                  #8

                  Hi, Then you should explicitly trim you description value coming from the database. This you can do in the ItemDataBound event of the datagrid. private void dg_ItemDataBound(object sender, DatagridItemEventArgs e) { if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternateItem) { if(e.Item.Cells[2].Text.Legth > 50) { e.Item.Cells[2].Text=e.Item.Cells[2].Text.Substring(0, 49) + "..."; } } } Here column 2 in the datagrid is bound to the description field of the datasource. I hope this will help you. Thanks and Regards, Chetan Ranpariya

                  A 1 Reply Last reply
                  0
                  • C Chetan Ranpariya

                    Hi, Then you should explicitly trim you description value coming from the database. This you can do in the ItemDataBound event of the datagrid. private void dg_ItemDataBound(object sender, DatagridItemEventArgs e) { if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternateItem) { if(e.Item.Cells[2].Text.Legth > 50) { e.Item.Cells[2].Text=e.Item.Cells[2].Text.Substring(0, 49) + "..."; } } } Here column 2 in the datagrid is bound to the description field of the datasource. I hope this will help you. Thanks and Regards, Chetan Ranpariya

                    A Offline
                    A Offline
                    A kamath
                    wrote on last edited by
                    #9

                    Thanks, I am very new to this field can u help me if I am giving this in codebehind and should I do anything in source code(Template feild).

                    C 1 Reply Last reply
                    0
                    • A A kamath

                      Thanks, I am very new to this field can u help me if I am giving this in codebehind and should I do anything in source code(Template feild).

                      C Offline
                      C Offline
                      Chetan Ranpariya
                      wrote on last edited by
                      #10

                      Hi, Put this is in codebehind and replace "private" with "public" and u have to do one thing in the .aspx file. set "OnItemDataBound" property of datagrid to "dg_ItemDataBound". I hope this will help you. Thanks and Regards, Chetan Ranpariya

                      A 1 Reply Last reply
                      0
                      • C Chetan Ranpariya

                        Hi, Put this is in codebehind and replace "private" with "public" and u have to do one thing in the .aspx file. set "OnItemDataBound" property of datagrid to "dg_ItemDataBound". I hope this will help you. Thanks and Regards, Chetan Ranpariya

                        A Offline
                        A Offline
                        A kamath
                        wrote on last edited by
                        #11

                        Thanks

                        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