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. Winforms Datagrid New Row

Winforms Datagrid New Row

Scheduled Pinned Locked Moved C#
csharpdatabasewinformsooptutorial
8 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.
  • A Offline
    A Offline
    airbus380
    wrote on last edited by
    #1

    I have an typed collection wich is bounded to datagrid control like this: dataGrid1.DataSource = collection; How to disable 'new row' in DataGrid ? --- object oriented uml oriented iconix oriented sql oriented truespace oriented --- solitare oriented :-)

    M 1 Reply Last reply
    0
    • A airbus380

      I have an typed collection wich is bounded to datagrid control like this: dataGrid1.DataSource = collection; How to disable 'new row' in DataGrid ? --- object oriented uml oriented iconix oriented sql oriented truespace oriented --- solitare oriented :-)

      M Offline
      M Offline
      miah alom
      wrote on last edited by
      #2

      CurrencyManager currencyManager = (CurrencyManager)this.BindingContext[this.dataTable]; if ( currencyManager != null ) { ((DataView)currencyManager.List).AllowNew = true; }

      A 1 Reply Last reply
      0
      • M miah alom

        CurrencyManager currencyManager = (CurrencyManager)this.BindingContext[this.dataTable]; if ( currencyManager != null ) { ((DataView)currencyManager.List).AllowNew = true; }

        A Offline
        A Offline
        airbus380
        wrote on last edited by
        #3

        Hy, 10x for response, but I have a collection bounded to Datagrid control not a DataSet/DataTable object oriented uml oriented iconix oriented sql oriented truespace oriented --- solitare oriented :-)

        M 1 Reply Last reply
        0
        • A airbus380

          Hy, 10x for response, but I have a collection bounded to Datagrid control not a DataSet/DataTable object oriented uml oriented iconix oriented sql oriented truespace oriented --- solitare oriented :-)

          M Offline
          M Offline
          miah alom
          wrote on last edited by
          #4

          I am using a collection called "GridLinkedListCollection" this.globalEntitySearchGrid.DataSource = this.linkedList; this.globalEntitySearchGrid.AllowNavigation = false; this.gridTableStyle = new DataGridTableStyle(); this.gridTableStyle.MappingName = "GridLinkedListCollection"; and the new row addition is disabled. Are you binding your DataGrid with code similar to above? Are you implementing IBindingList?

          A 2 Replies Last reply
          0
          • M miah alom

            I am using a collection called "GridLinkedListCollection" this.globalEntitySearchGrid.DataSource = this.linkedList; this.globalEntitySearchGrid.AllowNavigation = false; this.gridTableStyle = new DataGridTableStyle(); this.gridTableStyle.MappingName = "GridLinkedListCollection"; and the new row addition is disabled. Are you binding your DataGrid with code similar to above? Are you implementing IBindingList?

            A Offline
            A Offline
            airbus380
            wrote on last edited by
            #5

            Yes, indirectly. My collection is derived from CollectionTemplate (I use ORM.NET from Olero) base class collection witch implement IBindingList (is true). I just want that DataGrid to do not display new row. object oriented uml oriented iconix oriented sql oriented truespace oriented --- solitare oriented :-)

            M 1 Reply Last reply
            0
            • M miah alom

              I am using a collection called "GridLinkedListCollection" this.globalEntitySearchGrid.DataSource = this.linkedList; this.globalEntitySearchGrid.AllowNavigation = false; this.gridTableStyle = new DataGridTableStyle(); this.gridTableStyle.MappingName = "GridLinkedListCollection"; and the new row addition is disabled. Are you binding your DataGrid with code similar to above? Are you implementing IBindingList?

              A Offline
              A Offline
              airbus380
              wrote on last edited by
              #6

              This line ((DataView)currencyManager.List).AllowNew = true; generate an error: invalid cast ! 10x in advance --- object oriented uml oriented iconix oriented sql oriented truespace oriented --- solitare oriented :-) -- modified at 15:06 Thursday 8th September, 2005

              M 1 Reply Last reply
              0
              • A airbus380

                Yes, indirectly. My collection is derived from CollectionTemplate (I use ORM.NET from Olero) base class collection witch implement IBindingList (is true). I just want that DataGrid to do not display new row. object oriented uml oriented iconix oriented sql oriented truespace oriented --- solitare oriented :-)

                M Offline
                M Offline
                miah alom
                wrote on last edited by
                #7

                Since your collection imp-lements IBindingList, the property AllowNew may be available to you. http://msdn2.microsoft.com/en-us/library/dx7zc0k8(en-US,VS.80).aspx[^] Don't cast it to DataView in the code snippet. Hope this helps.

                1 Reply Last reply
                0
                • A airbus380

                  This line ((DataView)currencyManager.List).AllowNew = true; generate an error: invalid cast ! 10x in advance --- object oriented uml oriented iconix oriented sql oriented truespace oriented --- solitare oriented :-) -- modified at 15:06 Thursday 8th September, 2005

                  M Offline
                  M Offline
                  miah alom
                  wrote on last edited by
                  #8

                  In the quickwatch see the base type of currencyManager.List. That will definitely help.

                  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