We are experiencing an issue with our MVC SiteFinity application. When editing a grid inline having a foreign key dropdown column set as the first column displayed in the grid its necessary to click the grid confirm button twice to display all validation messages when the row has no data entered. The first click displays the validation message for the foreign key dropdown column and the second click then displays all subsequent column validation messages. The css code listed below is used to prevent another issue that was causing the validation message tool-tip for the dropdown foreign key column to be displayed underneath the subsequent row of the grid. If the foreign key dropdown column is not set as the first column in the grid on click of the confirm button then the validation messages all get displayed correctly when no data is entered.
// Gridview
<
div
class
=
"row"
id
=
"divGridApplicationStatuts"
style
=
"padding-top: 0px;"
>
@(Html.Kendo().Grid<
SitefinityWebApp.Mvc.Models.TypeActiviteReglementModel
>()
.Name("GridTypeActiviteReglements")
.Columns(columns =>
{
columns.Bound(p => p.Id).Title("No.").Width(25).Filterable(false).Sortable(true);
columns.ForeignKey(p => p.BeneficierId, (System.Collections.IEnumerable)ViewBag.Beneficiers, dataFieldValue: "BeneficierId", dataFieldText: "BeneficierName").Title("Bénéficier").Width(85).Filterable(true).Sortable(true).EditorTemplateName("TypesActivitesReglementsBeneficierEditor");
columns.Bound(p => p.Nom).Title("Type d'activité").Width(300).Filterable(false).Sortable(true);
columns.Command(command =>
{
command.Edit().Text("Éditer").UpdateText("Confirmer").CancelText("Annuler").HtmlAttributes(new { style = "padding:3px" });
command.Destroy().Text("Supprimer").HtmlAttributes(new { style = "padding:3px" });
}).Width(90);
})
.ToolBar(toolbar => toolbar.Create().Text("Ajouter"))
.Scrollable(scr => scr.Height(570))
.Sortable()
.Pageable()
.Filterable()
.Editable(editable => editable.Mode(GridEditMode.InLine))
.HtmlAttributes(new { style = "width:1048px" })
.Events(ev => ev.Edit("onEdit").Save("onSave"))
.DataSource(dataSource => dataSource
.Ajax()
.AutoSync(false)
.Events(e => e.RequestEnd("onRequestEnd"))
.Model(model =>
{
model.Id(p => p.Id);
})
.Sort(s => s.Add("Id").Ascending())
.PageSize(12)
.Events(events => events.Error("error"))
.Read(read => read.Url("/tar/TypesActivitesReglements/TypesActivitesReglementsRead").Data("sendAntiForgeryToken"))
.Create(create => create.Url("/tar/TypesActivitesReglements/TypesActivitesReglementsCreate").Data("sendAntiForgeryToken"))
.Update(update => update.Url("/tar/TypesActivitesReglements/TypesActivitesReglementsUpdate").Data("sendAntiForgeryToken"))
.Destroy(destroy => destroy.Url("/tar/TypesActivitesReglements/TypesActivitesReglementsDestroy").Data("sendAntiForgeryToken"))
.ServerOperation(true)
)
)
</
div
>
// Dropdown foreign key template
@(Html.Kendo().DropDownListFor(model => model)
.OptionLabel("- Sélectionnez - ")
.Name("BeneficierList")
.DataValueField("BeneficierId")
.DataTextField("BeneficierName")
.BindTo((IEnumerable)ViewBag.Beneficiers)
)
// Style fix
<
style
>
.k-tooltip {
/*height: 25px;*/
position: static;
white-space: normal;
}
.k-tooltip-validation .k-invalid-msg {
display: block;
}
.k-invalid-msg .k-callout {
display: block;
}
</
style
>