The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Updating current row in Infragistics Grid

Last post 02-21-2007, 4:55 AM by strattonn. 4 replies.
Sort Posts: Previous Next
  •  02-19-2007, 8:10 AM 391

    Updating current row in Infragistics Grid

    Hello all,

    I am trialing the Infragistics as well as learning EntitySpaces, life is better when it is full. Anyway I have the grid working wonderfully with the exception of attempting to save my current cell.

    Here is what I see,
    If I modify a field and attempt to close the form it does not detect any changes, if I click the Save button nothing is saved.
    If I modify a field, move to the next field and attempt to close the form it does not detect any changes, if I click the Save button the field is saved.
    If I modify a field, move to the next row and attempt to close the form it detects my changes, if I click the Save button the field is saved.

    I am not sure if this is Infragistics or EntitySpaces as I am new to both, hopefully you could give me a little insight here as to what is going on?

    The relevant code is pasted below.

    Thanks,
    Nigel

     

    public partial class frmUsers : Form
    {
    private UserCollection userCollection1 = new UserCollection();

       private void frmUsers_Load(object sender, EventArgs e)
       {
       userCollection1.LoadAll();

       //Connect the bindingsource to my user collection.
       userCollectionBindingSource.DataSource = userCollection1;

       //Setup the Infragistics combo box for user property - GridType
       gridTypeCollection1.LoadAll();
       ultraGridUsers.DisplayLayout.ValueLists.Add(
    "GridType");
       foreach (GridType GridItm in gridTypeCollection1)
       {
          ultraGridUsers.DisplayLayout.ValueLists[
    "GridType"].ValueListItems.Add(GridItm.GridType, GridItm.GridTypeDescr);
       }
       ultraGridUsers.DisplayLayout.Bands[0].Columns[
    "GridType"].ValueList =
       ultraGridUsers.DisplayLayout.ValueLists[
    "GridType"];
       }

       private void userCollectionBindingNavigatorSaveItem_Click(object sender, EventArgs e)
       {
       Validate();
       userCollectionBindingSource.EndEdit();
       userCollection1.Save();
       }

       private void frmUsers_FormClosing(object sender, FormClosingEventArgs e)
       {

       if (userCollection1.IsDirty)
       {
          if (MessageBox.Show("Unsaved changes, close form?","Logistics", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, 
             MessageBoxDefaultButton.Button2)!=System.Windows.Forms.DialogResult.Yes)
          {
             e.Cancel =
    true;
          }
       }
    }


     

  •  02-19-2007, 11:43 AM 398 in reply to 391

    Re: Updating current row in Infragistics Grid

    I have not used the Infragistics control so I do not know how it handles binding and notifications, but here are my thoughts:

    If a field is changed, but you do not move from the field, then you may have to call ultraGridUsers.EndEdit() before userCollectionBindingSource.EndEdit() to force the change.

    If a row is changed, but you do not move off the row, then userCollection1 will not be dirty. You might need to call ultraGridUsers.EndEdit() and check ultraGridUsers.IsDirty() instead.

    You probably should be calling Validate() and userCollectionBindingSource.EndEdit() in the Form Close as well before checking IsDirty.


    David Neal Parsons
    www.entityspaces.net
  •  02-20-2007, 10:09 AM 412 in reply to 398

    Re: Updating current row in Infragistics Grid

    Here is the solution. The grid may be in the process of updating a cell so we need to check the GridState and then force an UpdateData. In addition if you have a save button in a toolstip, it does not take focus when clicked and so we need the same code to force an updateData in the save method.

    I don't know if I need to call everything I call but this works.

    private void frmUsers_FormClosing(object sender, FormClosingEventArgs e)
    {

    if ((ultraGridUsers.CurrentState & UltraGridState.InEdit) == UltraGridState.InEdit)
    {
       ultraGridUsers.UpdateData();
    }

    Validate();
    userCollectionBindingSource.EndEdit();
    if (userCollection1.IsDirty)
    {
       if (MessageBox.Show("Unsaved changes, close form?","Logistics", MessageBoxButtons.YesNo, MessageBoxIcon.Warning,MessageBoxDefaultButton.Button2) 
         
    !=System.Windows.Forms.DialogResult.Yes)
       {
          e.Cancel =
    true;
       }
    }
    }

  •  02-20-2007, 5:35 PM 435 in reply to 412

    Re: Updating current row in Infragistics Grid

    Well, we're glad you got that. We will be beginning the ObjectDataSource work very soon for ES 1.6 and will be unit testing most of the major 3rd party grids, our first beta is due out on March 4th and we're going to need our customers who are using 3rd party grids to help test. The ObjectDataSource wont be in the first beta however, but soon to follow.

    Also, when posting code use the "code" button the toolbar, you'll see it, it's the last button on the right when you're editing a post.
     


    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  02-21-2007, 4:55 AM 443 in reply to 435

    Re: Updating current row in Infragistics Grid

    How will we know when the beta comes out?

    Thanks for the tip on pasting code, I missed the source code icon and was having a bear of a time formatting that stuff.

View as RSS news feed in XML