Hi all,
I am now using a Ultragrid to create a time schedule and make some data validation in the design view of the ultragrid. And now I would like to use a self-defined Error prompt instead of the datagrid default one,
I have already applied a CellDataError exception handler on it, but still, the datagrid default one still appear so that the system prompt my self defined error first and comes with the datagrid default one.
Can I disable/Override the default one?
Thanks,
Brian
Hello Daan Vermeulen,
I am glad that I was able to help.
Thank you for sharing your solution with the community.
Please feel free to let us know if you need any other assistance.
Hello Danko,
Thanks for this solution! I had a similar problem only the one thing I did extra was the following:
private void grid_CellDataError(object sender, CellDataErrorEventArgs e){ UltraGrid grid = (UltraGrid)sender; UltraGridCell activeCell = grid.ActiveCell; if(activeCell != null && activeCell.Column.Key == "ColumnTitle") { e.RaiseErrorEvent = false; MessageBox.Show("Specific error for the ColumnTitle", "Some title"); }
This because there are multiple columns and I only want this specific message to show when wrong data is typed in the specified column.
Hello Brian,
I am still following your thread.
Please feel free to let us know if you have any other questions with this matter.
If I understood correctly your scenario there are two possible approaches here that you could try in order to avoid this message to appear:
1. You could set the RaiseErrorEvent to False, which will prevent the message to appear as well as preventing the Error event to fire like:
private void ultraGrid1_CellDataError(object sender, Infragistics.Win.UltraWinGrid.CellDataErrorEventArgs e) { e.RaiseErrorEvent = false; }2. You could leave the RaiseErrorEvent setting to its Default value(which is true) and still allow the Error event to fire, because you could use the event args of the Error event to get some useful information like: the Source of the error, ErrorType, ErrorInfo, and once you have the needed details to cancel the event through its event args like:
private void ultraGrid1_Error(object sender, Infragistics.Win.UltraWinGrid.ErrorEventArgs e) { e.Cancel = true; //e.DataErrorInfo //e.ErrorText //e.ErrorType }
Please feel free to let me know If I misunderstood you or if you have any other questions with this matter.