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 data grid column header value dynamically

How to set data grid column header value dynamically

Scheduled Pinned Locked Moved ASP.NET
csshelptutorial
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.
  • P Offline
    P Offline
    perms
    wrote on last edited by
    #1

    Hi, I have the datagrid,it is working fine. the problem is i am passing single value from another page to this data gird page. I want to set that value as a column header value for that data grid. thanks.

    M 1 Reply Last reply
    0
    • P perms

      Hi, I have the datagrid,it is working fine. the problem is i am passing single value from another page to this data gird page. I want to set that value as a column header value for that data grid. thanks.

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      Hi there. You can use the HeaderText property for the DataGridColumn in question -- something like this:

      void Page_Load(Object sender, EventArgs e)
      {

      if (!IsPostBack)
      {
      // set the heading for the first column to a value passed in
      // from the querystring

      myDataGrid.Columns\[0\].HeaderText = Request.QueryString\["title"\];
      
      // ... normal datagrid binding ...
      

      }

      }

      P 1 Reply Last reply
      0
      • M Mike Ellison

        Hi there. You can use the HeaderText property for the DataGridColumn in question -- something like this:

        void Page_Load(Object sender, EventArgs e)
        {

        if (!IsPostBack)
        {
        // set the heading for the first column to a value passed in
        // from the querystring

        myDataGrid.Columns\[0\].HeaderText = Request.QueryString\["title"\];
        
        // ... normal datagrid binding ...
        

        }

        }

        P Offline
        P Offline
        perms
        wrote on last edited by
        #3

        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