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
195
UltraGrid FilterRow strange behavior, BUG? --> Error: Unable to update the data value:
posted

Infragistics V9.2

The best way to get a grip of this bug? Is propably to set a test application, se code below....

When done, try this:

- Filter custID:s by enter "1" in the filer cell

- Use the backspace key to delete the "1"

- Position the cursor to fname filter cell, using the mouse

- RESULT : Error Messagebox: Error: Unable to update the data value:

============== CODE "INSTRUCTIONS"===========

1. Create a windows form application

2. Copy the code below into Form1

3. Add a load event on the form, se code below

4. Add an InitializeLayout to the grid, se code below

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;

namespace WindowsFormsApplication
{
   public partial class Form1 : Form
   {
      public Form1()
      {
         InitializeComponent();
      }


      private void Form1_Load(object sender, EventArgs e)
      {
         // Set up the grid with some sample data.
         ultraGrid1.DataSource = OneBand;
      }

      private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
      {
         // Layout
         GeneralGridLayout(e);
         GeneralGridFilterLayout(e);

         // Width
         foreach (UltraGridColumn column in ultraGrid1.DisplayLayout.Bands[0].Columns)
         {
            column.Width = 150;
         }
      }

      public static DataSet OneBand
      {
         get
         {
            DataTable tblCust = new DataTable("customers");
            DataColumn col;

            col = new DataColumn("custID", typeof(int));
            tblCust.Columns.Add(col);

            tblCust.PrimaryKey = new DataColumn[] { col };

            col = new DataColumn("fname", typeof(string));
            tblCust.Columns.Add(col);

            col = new DataColumn("lname", typeof(string));
            tblCust.Columns.Add(col);

            col = new DataColumn("firstContact", typeof(DateTime));
            tblCust.Columns.Add(col);


            string[] names = {
        "Mike Finnigan",
        "Claudia Vanst",
        "Paul Forrest",
        "Dirk Spiggler",
        "Abraham Lincoln"
       };
            DateTime[] dates = {
           DateTime.Now.AddYears( -2 ),
           DateTime.Now.AddMonths( -1 ).AddMinutes( 19 ).AddSeconds( 2 ),
           DateTime.Now.AddHours( -4 ).AddMinutes( 3 ).AddSeconds( 7 ),
           DateTime.Now.AddDays( -1 ).AddMinutes( 123 ).AddSeconds( 12 ),
           DateTime.Now.AddMonths( -1 ).AddMinutes( 19 ).AddSeconds( 3 )
          };
            DataRow row;
            char[] delim = { ' ' };
            string[] name;
            for (int idx = 0; idx < names.Length; ++idx)
            {
               row = tblCust.NewRow();
               name = names[idx].Split(delim);

               row["custID"] = idx + 1;
               row["fname"] = name[0];
               row["lname"] = name[1];
               row["firstContact"] = dates[idx];

               tblCust.Rows.Add(row);
            }


            DataSet ds = new DataSet("CustInfo");

            ds.Tables.Add(tblCust);

            return ds;
         }
      }

      public static void GeneralGridLayout(InitializeLayoutEventArgs e)
      {
         e.Layout.ScrollStyle = ScrollStyle.Immediate;
         e.Layout.ScrollBounds = ScrollBounds.ScrollToFill;
      }

     
      public static void GeneralGridFilterLayout(InitializeLayoutEventArgs e)
      {
         e.Layout.Override.FilterUIType = FilterUIType.FilterRow;
         e.Layout.Override.FilterEvaluationTrigger = FilterEvaluationTrigger.OnCellValueChange;
         e.Layout.Override.FilterOperatorLocation = FilterOperatorLocation.WithOperand;
         e.Layout.Override.FilterOperatorDefaultValue = FilterOperatorDefaultValue.StartsWith;
         e.Layout.Override.FilterClearButtonLocation = FilterClearButtonLocation.RowAndCell;
         e.Layout.Override.FilterRowPromptAppearance.BackColorAlpha = Alpha.Opaque;
         e.Layout.Override.SpecialRowSeparator = SpecialRowSeparator.FilterRow;
         e.Layout.Override.SpecialRowSeparatorAppearance.BackColor = Color.FromArgb(233, 242, 199);
      }

   }
}