This question is locked. New answers and comments are not allowed.
Hello all,
I'm running into some issues trying to trigger the validation in my RadGridView which is in a custom control in lightswitch.
For the entity I am adding a property error (I've tried adding entity error as well with no luck) :
partial void StateCode_Validate(EntityValidationResultsBuilder results)
{
if (String.IsNullOrEmpty(StateCode) || this.StateCode.Length > 2)
{
results.AddPropertyError("State code must be two characters.");
}
}
Now in the custom control, I have set all the validation flags but cannot get the grid to pickup on the validation errors.
Is there something I am doing wrong here?
<Grid x:Name="LayoutRoot" Background="White">
<StackPanel Orientation="Vertical">
<telerik1:RadGridView x:Name="BrokerSOVGrid"
Width="1200"
AutoGenerateColumns="False"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ItemsSource="{Binding Screen.tblLocations, Mode=TwoWay,
ValidatesOnDataErrors=True,
NotifyOnValidationError=True}"
ActionOnLostFocus="CommitEdit"
ValidatesOnDataErrors="InViewMode">
<telerik1:RadGridView.Columns>
<telerik1:GridViewDataColumn Header="StateCode" UniqueName="StateCode"
DataMemberBinding="{Binding StateCode,
ValidatesOnDataErrors=True,
NotifyOnValidationError=True,
Mode=TwoWay,
ValidatesOnNotifyDataErrors=True,
ValidatesOnExceptions=True}"
ValidatesOnDataErrors="InEditMode"
/>
<telerik1:GridViewDataColumn UniqueName="NumBldgs"
DataMemberBinding="{Binding NumBldgs,
NotifyOnValidationError=True,
ValidatesOnDataErrors=True,
Mode=TwoWay,
ValidatesOnNotifyDataErrors=True,
ValidatesOnExceptions=True}"
ValidatesOnDataErrors="InEditMode"
/>
</telerik1:RadGridView.Columns>
</telerik1:RadGridView>
I've been back and forth trying to get this to work with no luck, could really use some backup.
The validation will trigger when I try to enter a string into an integer field... but it's not picking up on the custom validation rules we have made.
I'm running into some issues trying to trigger the validation in my RadGridView which is in a custom control in lightswitch.
For the entity I am adding a property error (I've tried adding entity error as well with no luck) :
partial void StateCode_Validate(EntityValidationResultsBuilder results)
{
if (String.IsNullOrEmpty(StateCode) || this.StateCode.Length > 2)
{
results.AddPropertyError("State code must be two characters.");
}
}
Now in the custom control, I have set all the validation flags but cannot get the grid to pickup on the validation errors.
Is there something I am doing wrong here?
<Grid x:Name="LayoutRoot" Background="White">
<StackPanel Orientation="Vertical">
<telerik1:RadGridView x:Name="BrokerSOVGrid"
Width="1200"
AutoGenerateColumns="False"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ItemsSource="{Binding Screen.tblLocations, Mode=TwoWay,
ValidatesOnDataErrors=True,
NotifyOnValidationError=True}"
ActionOnLostFocus="CommitEdit"
ValidatesOnDataErrors="InViewMode">
<telerik1:RadGridView.Columns>
<telerik1:GridViewDataColumn Header="StateCode" UniqueName="StateCode"
DataMemberBinding="{Binding StateCode,
ValidatesOnDataErrors=True,
NotifyOnValidationError=True,
Mode=TwoWay,
ValidatesOnNotifyDataErrors=True,
ValidatesOnExceptions=True}"
ValidatesOnDataErrors="InEditMode"
/>
<telerik1:GridViewDataColumn UniqueName="NumBldgs"
DataMemberBinding="{Binding NumBldgs,
NotifyOnValidationError=True,
ValidatesOnDataErrors=True,
Mode=TwoWay,
ValidatesOnNotifyDataErrors=True,
ValidatesOnExceptions=True}"
ValidatesOnDataErrors="InEditMode"
/>
</telerik1:RadGridView.Columns>
</telerik1:RadGridView>
I've been back and forth trying to get this to work with no luck, could really use some backup.
The validation will trigger when I try to enter a string into an integer field... but it's not picking up on the custom validation rules we have made.