This is a migrated thread and some comments may be shown as answers.

Getting Validation Message RadDataForm

3 Answers 90 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Jawad
Top achievements
Rank 1
Jawad asked on 16 Dec 2013, 10:56 AM
we are using Telerik RadDataForm in Our product which is using MVVM Pattern. we want to use our custom Commads  and Button for Commit and Cancel and to get this we are referencing RadDataFormStyle to set the command as shown.

<StackPanel x:Name="PART_FooterPanel" HorizontalAlignment="Right" Orientation="Horizontal">
                                  <telerik:RadButton x:Name="PART_CommitButton" Content="{TemplateBinding CommitButtonContent}" Command="{Binding Source={StaticResource DataContextProxy}, Path=Data.UpdateItem}"  InnerCornerRadius="0" Margin="2,4,4,4" MinWidth="48" MinHeight="20">
                                      <telerik:StyleManager.Theme>
                                          <telerik:Office_BlackTheme/>
                                      </telerik:StyleManager.Theme>
                                  </telerik:RadButton>
                                  <telerik:RadButton x:Name="PART_CancelButton" Content="{TemplateBinding CancelButtonContent}" Command="{Binding Source={StaticResource DataContextProxy},Path=Data.CancelItemUpdate}" InnerCornerRadius="0" Margin="2,4,4,4" MinWidth="48" MinHeight="20">
                                      <telerik:StyleManager.Theme>
                                          <telerik:Office_BlackTheme/>
                                      </telerik:StyleManager.Theme>
                                  </telerik:RadButton>
                              </StackPanel>

and following is the Rad Form Defined on the View. the CommandButtonsVisibility="None" is set to None because we don't want to see the navigation and other controls being used.
 
<telerik:RadDataForm x:Name="DataForm1"<br>                                     CurrentItem="{Binding CurrentLevelItem,UpdateSourceTrigger=PropertyChanged}"<br>                                     Style="{StaticResource RadDataFormStyle1}"<br>                                      DataFieldStyle="{StaticResource DataFormDataFieldStyle1}" AutoEdit="True" CommandButtonsVisibility="None"  /> 

The fields are auto generated and the problem is we want to get hold of the ValidationSummay in the View Model (if the condition of a text field etc is not met the Auto-generated validation Summary is Bound to a property in the view Model etc)to show it according to our requirements(i.e. on one of our self created Control to show information or errors etc) .
Is there a way to get hold of the validationSummay in the view Model?.

Thanks,
Jawad.

3 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 19 Dec 2013, 03:24 PM
Hi,

Basically, RadDataForm exposes a ValidationSummary property that contains the validation errors in its Errors collection. You can create a MVVM-friendly attached behavior that manages it at runtime. Additionally you can control ValidationSummary's visibility through the ValidationSummaryVsibility property. In case you need any additional assistance on this matter, I can prepare a sample project for you, but I will need some additional information on what exactly you are trying to achieve?

Regards,
Ivan Ivanov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Jawad
Top achievements
Rank 1
answered on 02 Jan 2014, 11:28 AM
Hi,

 It will be great If you can attach an example project on how to set attached behaviour to RadDataForm. following two main requirements we want to Achieve:

1): Firstly We have a Custom messageBar Control to display error messages in our Application. so I have Disabled the ValidationSummaryVisibility and  to populate the message bar I have to get hold of the RadDataform's Errors Collection in the View Model.

2):  We also want to use our own defined Cancel and Commit buttons as our Design Requirements. which means we will not be using the Commit and Cancel Buttons provided by the RadDataform. but we still want the Auto validation to be carried out on  commit command  (to give custom defined Commit buttons the same functionality as the default Rad commit Buttons) and any Validation Error will then be shown in the Message Bar.

Thanks,
Jawad.
0
Ivan Ivanov
Telerik team
answered on 07 Jan 2014, 02:52 PM
Hi Jawad,

Can you please shed some more light on your customization of Commit and Cancel buttons. They are bound to commands that trigger the validation logic internally? How do you plan to replace them? You can use a custom commands provider to override their default behavior. If you have some working code that illustrates your ideas, you can send it to us and I will try to encorporate it in a sample project.

Regards,
Ivan Ivanov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
DataForm
Asked by
Jawad
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Jawad
Top achievements
Rank 1
Share this question
or