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
105
Data Validation in UltraGrid using AfterCellUpdate Problem
posted

Hello,

 I need to validate a cell data in an UltraGrid and return a message to the user and allow him to enter the correct data after the message. My scenario:

- I have an UltraGrid with a fixed column and many dynamic columns after it. The datasource is passed in run-time because of the dynamic columns;

- The fixed column of the grid has a ValueList pointing to an UltraDropDown. This dropdown has an integer value (hidden) as value and a string as display element (not hidden).

- I am validating the data the user enter for that column throught the AfterCellUpdate based on a list of values. Sample code:

private void myGrid_AfterCellUpdate(object sender, CellEventArgs e)

{

   if (Convert.ToInt32(e.Cell.Value) != Convert.ToInt32(myList[index])

   {

      // Send message to the user

   }

}

The problem is that I need to keep focus on the column the user is updating. But when I enter the data, validate and see the error message the system is changing to the next column and not keeping focus on the column that I am validating.

Has anyone ever had to do a validation like this and keep the focus on the same column that is being validated instead of setting focus on the next column?

What I need is to use something like the CellDataError event, but I cannot raise this event inside the other. Or maybe if there was a mean to invalidate the column data somehow and then the grid will raise CellDataError.

Well I'm new to Infragistics and would appreciate any help you can provide.

[]'s