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. Gridview Column width in Codebehind at runtime

Gridview Column width in Codebehind at runtime

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

    Please help me..... I have a Gridview. I have to set column width at runtime in the codebehind. I am using C#. I had a plan to set width in RowDataBound(). But I don't know how to implement this.... Pls help me... urgent

    Sunil Nair

    S 1 Reply Last reply
    0
    • S Suryanairg

      Please help me..... I have a Gridview. I have to set column width at runtime in the codebehind. I am using C#. I had a plan to set width in RowDataBound(). But I don't know how to implement this.... Pls help me... urgent

      Sunil Nair

      S Offline
      S Offline
      Sun Rays
      wrote on last edited by
      #2

      Hi, u can set width at any stage. In page load also when binding grid. gvRaised.Columns[2].ItemStyle.Width = 200;

      Thanks, Sun Rays

      S 1 Reply Last reply
      0
      • S Sun Rays

        Hi, u can set width at any stage. In page load also when binding grid. gvRaised.Columns[2].ItemStyle.Width = 200;

        Thanks, Sun Rays

        S Offline
        S Offline
        Suryanairg
        wrote on last edited by
        #3

        My Gridview is populating dynamically. I dont know the exact no of coloumns which will come at runtime... I have to set headerrow coloumn width for all columns...

        Surya Nair

        S 1 Reply Last reply
        0
        • S Suryanairg

          My Gridview is populating dynamically. I dont know the exact no of coloumns which will come at runtime... I have to set headerrow coloumn width for all columns...

          Surya Nair

          S Offline
          S Offline
          Sun Rays
          wrote on last edited by
          #4

          Hi, then u must have to do as per below code. for(int i=0; i

          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