This might be not problem but I have face this during one of my project when I have used the DataForm control to show the data and when user navigate the data there are some required field which was not filled. It can be happened when one of your client give you their data in some format where they don't have validation of data like required fields etc. So it is important to enter those required field or other validation when you view the records.
Solution:When I see the problem as I have mention in above problem statement, then I have search for online solution for this problem as while navigating the record user can't see that a field is required if you don't give him/her some sort of indication that a field is required. In the Image 1 you can see that when you will navigate through the records , the second and the third records has invalid entries like the second record don't have Last name field and also the email ID is incorrect but in the Example 01 use will not ask to enter or correct these information and user will go to next records as you can see in the Image 1.
Image 1 |
For both the example Example 01 and Example 02 I have used same ViewModel and the Customer class which is used for this example is placed in the Classes folder. In the second example you can see that when you reach the second record which don't have Last name field and also the Email ID is not correct message are shown to the user to correct these entries , user will not move forward or backward until he/she correct the record as shown in the Image 2.
Image 2 |
The code which is used to validate the record while navigating is shown in the List 1. Here you can see that I have registered CurrentItemChanged event of the data form control and then in the event handler I have just called the ValidateItem function to validate the current item.
List 1
If you have face similar problem like I have face then you can solved it similar to what I have do in code behind just registered event and called the data form function to validate the current time.You can download the source code from here.
All and any comments / bugs / suggestions are welcomed!
No comments:
Post a Comment