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 remove last row from DataView before binding it to a DataGrid?

How to remove last row from DataView before binding it to a DataGrid?

Scheduled Pinned Locked Moved ASP.NET
wpfwcfalgorithmshelptutorial
2 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.
  • C Offline
    C Offline
    crazy_mads
    wrote on last edited by
    #1

    I have a DataView. I am Sorting the DataView and then removing the last row before binding it to dataGrid. dvViewOrder = new DataView(dtViewOrder); dvViewOrder.Sort = "VOD_ProductCategory ASC"; if (dtViewOrder.Rows.Count >= 2) dtViewOrder.Rows.RemoveAt(dtViewOrder.Rows.Count - 1); OrderList.DataSource = dvViewOrder; OrderList.DataBind(); Even tough I am removing it afte sorting. It is removing a row and then sorting. Can anyone help:( Mads

    J 1 Reply Last reply
    0
    • C crazy_mads

      I have a DataView. I am Sorting the DataView and then removing the last row before binding it to dataGrid. dvViewOrder = new DataView(dtViewOrder); dvViewOrder.Sort = "VOD_ProductCategory ASC"; if (dtViewOrder.Rows.Count >= 2) dtViewOrder.Rows.RemoveAt(dtViewOrder.Rows.Count - 1); OrderList.DataSource = dvViewOrder; OrderList.DataBind(); Even tough I am removing it afte sorting. It is removing a row and then sorting. Can anyone help:( Mads

      J Offline
      J Offline
      just3ala2
      wrote on last edited by
      #2

      Why don't u do that on the database side? I mean in a stored procedure u get the number of total rows and the select using "Set Rowcount " [the number - 1]

      Best Regards 3ala2 :)

      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