By Greg McGuffey - 3/22/2007
I often use a listbox to provide navigation on a BO. I.e. the listbox displays the available records, by name. The user clicks an item in the listbox and they are navigated to that record in the BO. I have a nice component that manages it.
I've recently run into the problem that if the user is editing a record, then clicks on the list while still in the editing mode, weirdness follows. So, I'd like to check if the BO is in editing mode BEFORE the selected item of the listbox changes. This way I can prompt the user to deal with any changes made. Unfortunately, I can't seem to find an event for a listbox that occurs BEFORE the selected item is changed. Is there one? Any suggestions would be appreciated!
|
By Trent L. Taylor - 3/22/2007
There is not an event for this so you have to handle it in the SelectedIndexChanged event. What we generally do is take a private variable and save off the selected index....after the index is moved (and before we navigate any children records, etc.) we check to make sure that everything was okee-dokey first. If not, we force the index of the list back to where it was and do not perform any of the navigation routines.
|
By Greg McGuffey - 3/22/2007
Thanks. What I ended up using was the BO.Navigating event. If the user canceled, I just synch the list back to the BO and cancel the navigation. I keep your idea in mind though...never know when I'll need it
|
|