I have a non-databound grid control where I am setting the cell up with the following code:
grdFilters[i+1, 2].CellValueType = typeof(int);
grdFilters[i+1, 2].ValidateValue.Minimum = 0;
If I enter in a negative number, when I click on certain areas outside the form this in on (child in an mdi) I get multiple out or range warnings. Is there any way to prevent this and limit it to the single warning.
July 12, 2003 07:44 AM
by default there should be only one warning be displayed. That is when you set focus on another control in the form that has CausesValidation set to True the grid will perform validation and save the current cell contents and the current record when its Control.OnValidate method is called.
If you don't want validation to occur set CausesValidation = false.
Did you embedd the grid inside another container? If yes, make sure only one of those have CausesValidation set. Otherwise the OnValidate is fired several times.
I hope this helps. Otherwise, if you can prepare a small sample project we'll look into this and can try to track it down what goes wrong.
July 14, 2003 05:57 AM
Well this might be the wrong forum but it is my syncfusion docking host that is also causing the validation to be fired. I would turn it off on the control in the docking host, however if the control becomes undocked them I am not sure what would happen.
July 14, 2003 06:50 AM
Would it be ok if you turn off CausesValidation for the MDI child window and then only validate the forms contents from its Close method? Or you could trigger also a Validate from specific buttons in the toolbar. I don't think you will want to validate contents for any button you click outside the grid or if you activate another mdi child window.
So, explicitly turning on CausesValidation, then calling Validate and then turn off CausesValidation again for the MDI child window for those buttons where you want validation is one work around I have in mind. But you will have to try around a bit.
July 14, 2003 10:58 AM
I tried turing off validation on the main mdi form, the groupbox control and them tree control. It still fires multiple times, and the call stack seems to point to the dockinghost firing it each time. Should I post this in the tools forum?
July 14, 2003 12:26 PM
If the events are coming from the dockinghost, then the tools forum would be the place. You could also submit a Direct Trac incident on this problem if you like.
July 14, 2003 01:58 PM
I have opened a direct-trac issue on this and created a sample of it, simple mdi with docking manager. I put tools instead of grid as the product. Not sure if that is the right way to go on this. The direct-track # is 5641.