Created
October 29, 2020 17:24
-
-
Save bbqchickenrobot/c0b67c9ee15f789bd55d549a73f71948 to your computer and use it in GitHub Desktop.
Blazorise DataGrid Validation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private async Task RowInserting(CancellableRowChange < FeatureToggle, Dictionary < String, Object >> e) { log.LogInformation($ "values = {e.Values.ToJson()}"); log.LogInformation($ "validating feature {e.Item.Feature}"); | |
| if (string.IsNullOrEmpty(e.Item.Feature)) { log.LogError($ "validation failed for rule {e.Item.Dump()}"); toastService.ShowError($ "validation failed for {nameof(FeatureToggle)}. Feature name is required."); e.Cancel = true; | |
| } | |
| else { e.Cancel = false; | |
| } | |
| } private async Task RowUpdating(CancellableRowChange < FeatureToggle, Dictionary < String, Object >> e) { log.LogInformation($ "values = {e.Values.ToJson()}"); log.LogInformation($ "validating feature {e.Item.Feature}"); | |
| if (string.IsNullOrEmpty(e.Item.Feature)) { log.LogError($ "validation failed for rule {e.Item.Dump()}"); toastService.ShowError($ "validation failed for {nameof(FeatureToggle)}. Feature name is required."); e.Cancel = true; | |
| } | |
| else { e.Cancel = false; | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the values in the e.Item are always null..... not sure why as they should be included in the parameter