Exemple #1
0
 private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
 {
     advBandedGridView1.ClearColumnsFilter();
     if (CruItItemBindingSource.Current == null)
     {
         //fake query in order to create a link between the database table and the binding source
         CruItItemBindingSource.DataSource = from opt in context.CRUITItem where opt.CODE == "KJM9" select opt;
         CruItItemBindingSource.AddNew();
         //gridSearchControl1.Focus();
         newRec = true;
         return;
     }
     advBandedGridView1.Focus();
     //bindingNavigatorPositionItem.Focus();  //trigger field leave event
     temp = newRec;
     if (checkForms())
     {
         if (!temp)
         {
             context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, (CRUITItem)CruItItemBindingSource.Current);
         }
         CruItItemBindingSource.AddNew();
         newRec = true;
     }
 }