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. Problem with linq on Gridview

Problem with linq on Gridview

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

    Hi I have an object which is a collection, which is a collection, I use linq to group the data based upon a value, and then I bind the data to the gridview data source. This gives me a gridview per group, which is exactly what I want. However, when the gridview is displayed what I am seeing is one: not the correct number of rows for the first group, and two, more importantly I am seeing rows which should be in the next group. It is though it is not filtering correctly, or the gridview is not binding correctly. I have checked the linq in debug and seems fine, I have checked the data in the collection object, and this is fine. So, I am lost as to what is going on. Can anyone help me! Collection<DeptGroups> depts = this.Model.GetGroups(); var dept = (from deptToSelect in depts Select dept.name).Distinct(); foreach(string deptToFilter in dept) { var country = from worldRegion in depts where worldRegion.name = deptToFilter select worldRegion; gvDept.DataSource = country; }

    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