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

Validation not working on Model Bound Grid

1 Answer 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 19 Apr 2016, 02:36 PM

 

I can not get this simple required field validator column to trigger. I've followed the examples and tried various different syntax options. Can anyone shed lany light on why this isn't firing?

<telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticInserts="true" AllowPaging="true"
                        ItemType="MYCOMPANY.BusinessData.BusinessObjects.Participant"  
                        AutoGenerateColumns="False" AutoGenerateDeleteColumn="true"
                        AutoGenerateEditColumn="True" 
                        GroupPanelPosition="Top" Skin="Metro">
                        <%--<ValidationSettings EnableValidation="true" CommandsToValidate="PerformInsert" />--%>
                        <MasterTableView CommandItemDisplay="Top" AllowAutomaticInserts="true" InsertItemDisplay="Top" DataKeyNames="ParticipantID" 
                            InsertMethod="insertParticipant" DeleteMethod="deleteParticipant" UpdateMethod="updateParticipant" SelectMethod="getParticipants" 
                            PageSize="12">
                                <Columns>
                                <telerik:GridBoundColumn DataField="Username" HeaderText="Username" UniqueName="Username" ColumnEditorID="Username">
                                    <ColumnValidationSettings EnableRequiredFieldValidation="true" EnableModelErrorMessageValidation="true">
                                        <RequiredFieldValidator SetFocusOnError="true" ErrorMessage="* - Required Field" ForeColor="Red" Font-Bold="true" />
                                        <ModelErrorMessage ModelStateKey="Username" AssociatedControlID="Username" SetFocusOnError="true" ForeColor="Red"                                                   Font-Bold="true" />

                                    </ColumnValidationSettings>
                                </telerik:GridBoundColumn>

 

 

Thanks in advance!

Michael

1 Answer, 1 is accepted

Sort by
0
Michael
Top achievements
Rank 1
answered on 19 Apr 2016, 04:07 PM
I'm noticing that my classes don't have data annotations. Going to put them in and see if it helps.
Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Michael
Top achievements
Rank 1
Share this question
or