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. General Programming
  3. C#
  4. Remove + sign from datagrid?

Remove + sign from datagrid?

Scheduled Pinned Locked Moved C#
helptutorialquestion
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.
  • M Offline
    M Offline
    Marcus_2
    wrote on last edited by
    #1

    Hello I have a problem that I can't find any solution to. I have an arraylist of objects that I want to show in a datagrid and that works just fine. The problem is when the objects themselves has an internal property that is an arraylist, then the datagrid will show the "+" sign att each row. I want the datagrid to show only the "parent" rows without drilldown features. For examplepublic class MyStuff { string stuff; public MyStuff() {} public MyStuff(string NewValue) { stuff = NewValue; } public Stuff { get{return stuff;} set{stuff = value;} } } arraylist MyList = new arraylist; for (int iI = 0, ii <10, ii++) mylist.add(new MyStuff(ii.tostring())) datgrid1.datasource = MyList
    works just fine, butpublic class MySecondStuff { string stuff; public MySecondStuff(string NewValue) { stuff = NewValue; } public Stuff { get{return stuff;} set{stuff = value;} } } public class MyStuff { string stuff; arraylist arList = new arraylist(); public MyStuff(string NewValue) { stuff = NewValue; for (int iI = 0, ii <10, ii++) arList.add(new MySecondStuff(ii.tostring())) } public Stuff { get{return stuff;} set{stuff = value;} } } //and then arraylist MyList = new arraylist; for (int iI = 0, ii <10, ii++) mylist.add(new MyStuff(ii.tostring())) datgrid1.datasource = MyList
    Will show the parent MyStuff correctly in the datagrid but each row will have the "+" sign next to it and allow the user to see the MySecondStuff class under it. Can anyone please say how I can remove the "+" sign when working with arraylist or collections in the datagrid? I now the code above doesnt work, just wrote it to explain how the classes are built when they are viewd in a datagrid.:-O Best regards /Marcus

    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