Hi, I am using the following MVC Helper to generate iggrid. I saw multiple samples for email validation, but there are only show email validation for simple controls. How can I add email validation with a regex for the below bolded column in the sample below. Also is there an option to add placeholder for columns in RowEditDialog template
@(Html.Infragistics() .Grid(Model) .ID("grid") .PrimaryKey("id") .AutoGenerateColumns(false) .AutoGenerateLayouts(false) .LoadOnDemand(true) .Columns(column => { column.For(x => x.id).Hidden(true); column.For(x => x.email).HeaderText("Email Address").Width("20%").Template("<input type='button' data-id='${email}' onclick='SendResetPasswordEmail(this);' value='Reset'/> ${email}"); column.For(x => x.firstname).HeaderText("First Name").Width("20%"); column.For(x => x.lastname).HeaderText("Last Name").Width("30%"); column.For(x => x.typeid).HeaderText("Type").Width("5%").FormatterFunction("lookupUserTypes"); }) .Features(feature => { feature.Updating().EditMode(GridEditMode.RowEditTemplate).AddRowLabel("Add new User").RowEditDialogCaptionLabel("Edit User").ColumnSettings(cs => { cs.ColumnSetting().ColumnKey("email").Required(true).Validation(true); cs.ColumnSetting().ColumnKey("firstname").Required(true).EditorType(ColumnEditorType.Text); cs.ColumnSetting().ColumnKey("lastname").Required(true); cs.ColumnSetting().ColumnKey("typeid").EditorType(ColumnEditorType.Combo).Required(true).ComboEditorOptions(co => co.DataSource(northWindCategoriesJSON).ValueKey("typeid").TextKey("UserTypeName").Mode(ComboMode.DropDown).EnableClearButton(false)); }); feature.Sorting(); feature.Filtering(); feature.Paging(); }) .DataSourceUrl(Url.Action("GetUsers")) .ResponseDataKey(null) .UpdateUrl(Url.Action("UsersSaveData")) .DataBind() .Render())
Hi,
Here is an example:
cs.ColumnSetting().ColumnKey("email").TextEditorOptions(te=> {
te.NullText("email");
te.ValidatorOptions(v =>
{
v.RegExp("...");
});
Regards,
Tsanna
Can you please provide me example of Validators for MVC Helper. All the examples that I saw are for jquery.
Hello Ashwini,
The equivalents for these options in 15.1 are:
- placeholder --> nullText
- pattern --> regExp
Please try them and let me know if you need further assistance.
Infragistics.Web.Mvc.dll version is 5.15.1.2352.
If these extensions are not available in that version, are there any other options to do validation & placeholder.
Please note that these options are available from v15.2. Which version are you currently using?