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

Understanding Field Validation Errors while in-line Edit mode

7 Answers 226 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Reid
Top achievements
Rank 2
Reid asked on 23 Jan 2012, 03:10 PM
Hi All,

I am trying to implement the in-line Ajax Editing of records in a Grid using this as an example:
http://demos.telerik.com/aspnet-mvc/grid/editingajax

I am not understanding how to implement the Field Validation correctly for the Grid in Edit mode using the in-line or in-place style. My model has the field attributes that basically mirror the demo. 

It appears that the edits that require values only light up with the message when you have entered the field and typed a value then removed it.  If I click the "Insert" button the form submits.

Can someone help and point out what is needed so that the validation errors only show either after a values was removed in a required field,  *and/or* when you click the insert button?

Much appreciated.

Thanks,
Reid

7 Answers, 1 is accepted

Sort by
0
Reid
Top achievements
Rank 2
answered on 23 Jan 2012, 06:08 PM
Ok update here, I discoved that submitting the model for insert and first calling TryUpdateModel(entity) returns the Grid Action and the row shows the required fields validation errors. 

I still have a question though, the error messages overlap.  Can you make the message wrap? Or is there a way to just highlight the control in the row in red as it does but also have the option of routing the message(s) to another output source, like a div?

Thanks,

Reid
0
Daniel
Telerik team
answered on 25 Jan 2012, 04:25 PM
Hello Reid,

By default the validation error messages are shown inside the table cells. So there is no way for the messages to overlap. If you wish to use an image, as in the demo, you should adjust the styles based on the particular Grid.
Making a request to insert a record is unexpected when there are validation errors. The client-side validation should prevent the request from being made. I suggest to check the Common Validation Problems code library. If non of the suggestions in it apply to your case I will need a sample project which reproduces this behaviour in order to investigate further.

All the best,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Reid
Top achievements
Rank 2
answered on 26 Jan 2012, 12:55 AM
Hi Daniel,

Thanks for the reply and for the link.  It does seem like it is working, just not formatting corectly now.  You mention that it cannot overlap because the text is contained in the cell.  In my case it is not.  I have attached a screen shot to illustrate what is happening.

Thanks for the support.

Reid
0
Daniel
Telerik team
answered on 26 Jan 2012, 12:44 PM
Hello Reid,

The messages would be displayed like that if you have added the styles used in the Ajax Editing demo. You should remove them if you want the messages to be displayed inside the cells.

Kind regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Reid
Top achievements
Rank 2
answered on 26 Jan 2012, 01:59 PM
Hello Daniel,

Ok that solved the wrapping issue thanks.  One issue I do see is that the controls do not align correctly now after removing those styles.  As you can see from my attachment, the controls do not align and they are partially truncated visually.  No way to scroll up and get the controls in full view.

Do you know what needs to be done to correct this?


Thanks,

Reid
0
Daniel
Telerik team
answered on 30 Jan 2012, 11:09 AM
Hi Reid,

I am not sure what may be causing the problem. Do you have any custom styles applied to the Grid? If not, could you send a sample project which reproduces the problem so I could check the exact setup?

Kind regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Reid
Top achievements
Rank 2
answered on 31 Jan 2012, 01:45 PM
Hello Daniel,

The view has no code to alter styles, and .css is not my forte.  There might be something in the designer's .CSS that is interfering, not sure.  I have been really busy over the last week or so, and responding to the threads I created is falling behind so contructing a new project, all the same .JS all the same .css would take a while.  I will try.

Thanks for helping.

Reid
Tags
Grid
Asked by
Reid
Top achievements
Rank 2
Answers by
Reid
Top achievements
Rank 2
Daniel
Telerik team
Share this question
or