I have an Asp.net MVC/Razor app using the Infragistics JQuery controls and I would like to limit the number of characters entered in a igTextEditor. On my page I have
@(Html.Infragistics().TextEditorFor(m=>m.Name).ID("assemblyNameEditor").ValidatorOptions(m=>m.OnBlur(true).OnSubmit(true).FormSubmit(true).KeepFocus(ValidatorKeepFocus.Once)).Required(true)
and then down in my JQuery script section I have
$("#assemblyNameEditor").igTextEditor("option", "maxLength", 10);
when looking at the rendered page I see that the maxlength attribute was not added. SO then I just used simple jquery to add the maxlength attribute ...
$("#assemblyNameEditor").attr("maxLength", 10);
which rendered fine but for some reason was still not limiting the characters.
So then I was I hoping I could at least decorate my model with DataAnnotations such as
[StringLength(20, ErrorMessage = "Must be under 20 characters")]
and have have validation catch it on submit, but that didn't work either.
Not sure what else to try??
Hello Mlangowski,
Have you tried setting the maxlength of the texteditor something like below, I was able to limit the characters in the editor using the following code
@(Html.Infragistics().TextEditor()
.ID("textEditor")
.MaxLength(10)
.Width(200)
.NullText("Enter Text")
.Render())
Please let me know if you have any further questions regarding this matter.
Umm... MaxLength ?? TextEditor does not have a MaxLength method defined. Is this an extension method?
I am using version v4.0.30319 of Infragistics.Web.Mvc.
I have the same problem with the following igTextEditor configuration
$('#myText').igTextEditor({
width:200,
value:'udc'
text:'udc'
type:"text",
maxLength:10
})
And I don't want to use it with Asp.net MVC