This question is locked. New answers and comments are not allowed.
Hi
I'm having an issue with the RadGridView in conjunction with the RegularExpressionAttribute. The grid has the following code:
The entity looks like this:
The entity is transmitted to the Silverlight client with RIA Services. I tested the regular expression in a console application and it works there. When I replace the regex with ".*" it works. How can I fix this? I really need regex validation on that property.
Lukas
I'm having an issue with the RadGridView in conjunction with the RegularExpressionAttribute. The grid has the following code:
<telerik:RadGridView Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="5" AutoExpandGroups="True" AutoGenerateColumns="False" CanUserDeleteRows="False" CanUserFreezeColumns="False" CanUserInsertRows="False" CanUserSelect="True" CanUserSortColumns="False" CanUserSortGroups="False" IsFilteringAllowed="False" ItemsSource="{Binding Templates}" SelectedItem="{Binding SelectedTemplate, Mode=TwoWay}" ShowGroupPanel="False"> <telerik:RadGridView.GroupDescriptors> <telerik:GroupDescriptor Member="Category.Name" /> </telerik:RadGridView.GroupDescriptors> <telerik:RadGridView.Columns> <telerik:GridViewColumn> <telerik:GridViewColumn.CellTemplate> <DataTemplate> <Grid Margin="2"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="2" /> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="2" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <Button Command="{Binding DataContext.EditTemplateCommand, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType=telerik:RadGridView}}" CommandParameter="{Binding}"> <Image Width="16" Height="16" Source="/Common;component/Images/Icons/edit.png" Stretch="Fill" /> </Button> <Button Grid.Column="2" Command="{Binding DataContext.CopyTemplateCommand, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType=telerik:RadGridView}}" CommandParameter="{Binding}"> <Image Width="16" Height="16" Source="/Common;component/Images/Icons/copy.png" Stretch="Uniform" /> </Button> <Button Grid.Column="4" Command="{Binding DataContext.RemoveTemplateCommand, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType=telerik:RadGridView}}" CommandParameter="{Binding}"> <Image Width="16" Height="16" Source="/Common;component/Images/Icons/trash.png" Stretch="Fill" /> </Button> </Grid> </DataTemplate> </telerik:GridViewColumn.CellTemplate> </telerik:GridViewColumn> <telerik:GridViewDataColumn Width="*" DataMemberBinding="{Binding Title}" Header="{Binding Title, Source={StaticResource Strings}}" /> </telerik:RadGridView.Columns></telerik:RadGridView>The entity looks like this:
public class DocumentTemplate{ [Key] public int Id { get; set; } [StringLength(50)] [RegularExpression(@"^[^\\~#%&*{}/:<>?|\" + "\"" + "-]+$", ErrorMessageResourceType = typeof(ValidationStrings), ErrorMessageResourceName = "TemplateTitleInvalid")] public string Title { get; set; } [StringLength(100)] public string FileName { get; set; } public string Xaml { get; set; } [Include, Association("DocumentTemplate_DataSources", "Id", "TemplateId")] public ICollection<DocumentDataSource> DataSources { get; set; } [Include, Association("DocumentTemplate_Category", "CategoryId", "Id")] public DocumentTemplateCategory Category { get; set; } public int CategoryId { get; set; } public DocumentTemplate() { DataSources = new HashSet<DocumentDataSource>(); }}The entity is transmitted to the Silverlight client with RIA Services. I tested the regular expression in a console application and it works there. When I replace the regex with ".*" it works. How can I fix this? I really need regex validation on that property.
Lukas