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 - how to avoid adding an item

Datagrid - how to avoid adding an item

Scheduled Pinned Locked Moved ASP.NET
csharpcssasp-netwpfwcf
2 Posts 2 Posters 1 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.
  • T Offline
    T Offline
    thowra
    wrote on last edited by
    #1

    Hi, I'm populating a datagrid in ASP.NET 1.1 and after binding it to a collection, the ItemDataBound event allows me to access the data after it's entered as a row into the grid. I can add tooltips to the individual cells depending on the cell value and so on, which is very useful. However, I also have need to exclude some of my items from ever being displayed in the grid and so I'd like to handle an event which occurs before each row in the datagrid is populated. In this way I can filter the contents of my datagrid rather than apply any filtering to the collection class which for one reason or another, I don't wish to do. Is there any way of capturing the item *before* it's added to the grid to stop it ever being displayed? In other words, can I filter a grid at this level?

    Evil cannot be conquered in the world... It can only be resisted within oneself.

    M 1 Reply Last reply
    0
    • T thowra

      Hi, I'm populating a datagrid in ASP.NET 1.1 and after binding it to a collection, the ItemDataBound event allows me to access the data after it's entered as a row into the grid. I can add tooltips to the individual cells depending on the cell value and so on, which is very useful. However, I also have need to exclude some of my items from ever being displayed in the grid and so I'd like to handle an event which occurs before each row in the datagrid is populated. In this way I can filter the contents of my datagrid rather than apply any filtering to the collection class which for one reason or another, I don't wish to do. Is there any way of capturing the item *before* it's added to the grid to stop it ever being displayed? In other words, can I filter a grid at this level?

      Evil cannot be conquered in the world... It can only be resisted within oneself.

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Hi there, In this case, you can think of hiding the datagrid row (DataGridItem) using the Visible property, so depending on the databound bound to the row you can set either the specific cells of the row or the entire row invisible, and the user does not see that displayed on the grid.

      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