I have a custom web part with custom web part property. This web part queries from a list.
The webpart property is "Sorting" and user has to select if sorting is "Alphabetical" or "Custom"
Choosing Alphabetical will arrange contents in my web part alphabetically - No problem with this.
Choosing Custom will arrange contents in my web part by ascending based on the 'Sort' column of my list.
Now, in my web part property validation, I will check if the user selected Custom and 'Sort' column in my list has no values. Then it will throw the WebPartPageUserException showing that the 'Sort' column has null values.
Here's the loophole.
1. I will go to the list, and fill out the 'Sort' column
2. I will edit the property of my web part and choose Custom - this will accept it because the 'Sort' column now have values
3. My web part will now show Custom Sorting
4. I will go back to the list and remove the entries under the 'Sort' column
5. My WebPart will have an error (Web Part Maintenance page)
What should I do so that if ever the loophole steps are done. My custom web part property will set it to 'Alphabetical'? or it will sort it alpahebtically?