我在我的模型中使用AllowHtml for CKeditor,我也分配了必填字段,但验证不起作用,我的模型如下: -
[Display(Name = "Introduction Details:")]
[Required(ErrorMessage = "Introduction Details is required.")]
[AllowHtml]
public string Introduction { get; set; }
答案 0 :(得分:0)
<script type="text/javascript">
$(document).ready(function () {
$('#CkEditor1').ckeditor();
$('#Testimonials_error').hide();
});
function GetCKEditorData() {
var data = $('#CkEditor1').val();
if (data != "") {
var c = confirm("Do you want to save this record");
if (c) {
window.location.href = "/Admin/Testimonials";
}
}
else {
$('#Testimonials_error').show();
return false;
}
}
</script>