Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
185
Email Validation for RowEditDialog column
posted

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()
)

Parents
  • 15320
    Offline posted

    Hello Ashwini,

    You can add placeholder to the respective column editor through the editor options, for example:

    cs.ColumnSetting().ColumnKey("email").TextEditorOptions(te=> {

    te.PlaceHolder("email");

    });

    You can add email validation using regular expression through the validator options of the respective column, for example:

    features.Updating().ColumnSettings(cs=>{

    cs.ColumnSetting().ColumnKey("email").TextEditorOptions(te=> {

    te.PlaceHolder("email");

    te.ValidatorOptions(v =>

    {

    v.Pattern("...", "error message");

    });

    });

    });

    If you need further assistance, please let me know.

    Regards,

    Tsanna

Reply Children