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. Clearing columns from gridview

Clearing columns from gridview

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

    Hi, I have a gridview which has few dynamic columns and few static columns. Each time of reload of the gridview I want to clear all the dynamic column only. But while using the columns.clear property of gridview it is clearing all the columns. Is there any way that I can clear only the dynamic columns.

    Thanks & Regards Mishra

    N P 2 Replies Last reply
    0
    • B Ballita

      Hi, I have a gridview which has few dynamic columns and few static columns. Each time of reload of the gridview I want to clear all the dynamic column only. But while using the columns.clear property of gridview it is clearing all the columns. Is there any way that I can clear only the dynamic columns.

      Thanks & Regards Mishra

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      Iterate through columns collection and remove individually. For this you need to keep the dynamically generated columns index/name somewhere.


      My Website | Ask smart questions

      B 1 Reply Last reply
      0
      • N N a v a n e e t h

        Iterate through columns collection and remove individually. For this you need to keep the dynamically generated columns index/name somewhere.


        My Website | Ask smart questions

        B Offline
        B Offline
        Ballita
        wrote on last edited by
        #3

        How can I keep the index of dynamically generated column. Is there any way.

        Thanks & Regards Mishra

        N 1 Reply Last reply
        0
        • B Ballita

          How can I keep the index of dynamically generated column. Is there any way.

          Thanks & Regards Mishra

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          Ballita wrote:

          How can I keep the index of dynamically generated column. Is there any way.

          Might me in 1 - Viewstates 2 - Session


          My Website | Ask smart questions

          1 Reply Last reply
          0
          • B Ballita

            Hi, I have a gridview which has few dynamic columns and few static columns. Each time of reload of the gridview I want to clear all the dynamic column only. But while using the columns.clear property of gridview it is clearing all the columns. Is there any way that I can clear only the dynamic columns.

            Thanks & Regards Mishra

            P Offline
            P Offline
            Pankaj Chamria
            wrote on last edited by
            #5

            Hi Ballita, For your problem I think using the RowDataBound event of the GridView will be a better idea. While each row is getting bound you can dynamically decide which cols will be visible. You can also do other stuff like clear the content of the cells of that row before binding.

            Pankaj Chamria, Software Programmer.

            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