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. DropDowns/GridView Column

DropDowns/GridView Column

Scheduled Pinned Locked Moved ASP.NET
help
2 Posts 1 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.
  • F Offline
    F Offline
    ffowler
    wrote on last edited by
    #1

    Hello All, Have a problem where I would like to display a column only if a particular item is selected in a drop down. To be more specific, I display some values in a gridview and the last column contains a link that removes (actually just archives by setting a bit flag) the row from being displayed in the "Active" view. If the user wants to see "Archived" rows, they would select it from the DropDownList and the page automatically posts and displays the archived items. But the last column with the link still appears. In this view, the "Remove" link is useless and somewhat unprofessional looking. What I need help with is NOT showing that column when the SelectedIndex of the DropDown is == 1. If it is == 0 then I want the last column to show as normal. I have tried "GridView.Columns.RemoveAt" which works the first time but doesn't show again. So, is there anyway to hide a column on a postback and make if visible again. Thanks in advance for any suggestions.

    F 1 Reply Last reply
    0
    • F ffowler

      Hello All, Have a problem where I would like to display a column only if a particular item is selected in a drop down. To be more specific, I display some values in a gridview and the last column contains a link that removes (actually just archives by setting a bit flag) the row from being displayed in the "Active" view. If the user wants to see "Archived" rows, they would select it from the DropDownList and the page automatically posts and displays the archived items. But the last column with the link still appears. In this view, the "Remove" link is useless and somewhat unprofessional looking. What I need help with is NOT showing that column when the SelectedIndex of the DropDown is == 1. If it is == 0 then I want the last column to show as normal. I have tried "GridView.Columns.RemoveAt" which works the first time but doesn't show again. So, is there anyway to hide a column on a postback and make if visible again. Thanks in advance for any suggestions.

      F Offline
      F Offline
      ffowler
      wrote on last edited by
      #2

      Sorry for the quick posting. I got it to work by: if (blah blah) { GridView1.Column[4].Visible = false } else { true } Thanks anyway gang. Take care

      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