Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
55
AddNew row disappears
posted

Infragistics Net Advantage Version 11.1.20111.2009

In Visual Studio 2008, I have a ultragrid bound to a bindingsource.  I also have a bindingnavigator toolstrip on the form.  I have a templateaddrow activated showing the add new row at the bottom of the grid.  By default, the form loads and the cursor is located in the add new row, first field.  When I click on a grid row with data, the addnew row disappears (this also happens when I click the cancel button in the navigator which issues the command grid.activerow.cancelupdate).  How can I keep the addnew row from disappearing?  To resolve this, if the user clicks the Add New in the navigator control, I execute the command grid.rows.templateaddrow.active and the addnew row comes back.

I thought that this might be related to having the grid bound to a bindingsource, but I changed my logic and bound the data directly to a dataset, and the same problem occurs.  Here is my code (I have the bindingsource lines commented out to test the dataset) - (also, as a side note, pressing the ESC key twice also causes the addnew row to disappear and this behaviour does not appear to happen when using Visual Studio 2010):

         Try
            myNoticesDS.Tables.Add("Notices")
            myNoticesDA.Fill(myNoticesDS.Tables("Notices"))
            oleCB = New OleDbCommandBuilder(myNoticesDA)
            myNoticesDA.InsertCommand = oleCB.GetInsertCommand()
            myNoticesDA.UpdateCommand = oleCB.GetUpdateCommand()
            myNoticesDA.DeleteCommand = oleCB.GetDeleteCommand()

            'MyBindingSource.DataSource = myNoticesDS.Tables("Notices")
            'BindFields(Me, "Notices", myNoticesDS, MyBindingSource)
            'myBinding = Me.BindingContext(myNoticesDS, "Notices")
            'BindingNavigator1.BindingSource = MyBindingSource
            'BindingNavigator1.DeleteItem = Nothing
            'BindingNavigator1.AddNewItem = Nothing
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

        'grdDataGrid.DataSource = myBindingSource
        grdDataGrid.DataSource = myNoticesDS
        With grdDataGrid
            .Rows.TemplateAddRow.Activate()
            With .DisplayLayout
                .Override.RowSelectors = Infragistics.Win.DefaultableBoolean.True
                .AddNewBox.Hidden = True
                .Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti
                .Override.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.TabRepeat
                .Override.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.TemplateOnBottom
            End With
        End With

Please advise.

Thanks.  Paul