I would like to setup a validation rule that would conditionally be applied. For example
I have three fields
Status: Enum field (pending, approved, denied)
Denied Code: (price, qty, misc..., ect...)
Comment (Long text)
So if the Status is equal to denied I want the Denied Code and Comment to require an update otherwise ignore them. Is this possible? and if so how would I go about doing this? Also the value of the Denied Code must not equal none.
My Index page:
<
style
>
.cont {
padding-right: 10%;
padding-left: 10%;
margin-right: auto;
margin-left: auto;
}
</
style
>
<
div
class
=
"cont"
>
@(Html.Kendo().Grid<
Portal.Model.DAX.PurchaseJournalTransaction
>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(c => c.PurchId).Title("Order Id").Width(120);
columns.Bound(c => c.LineNum).Title("Line").Width(80).Hidden(true).IncludeInMenu(true);
columns.Bound(c => c.ItemId).Width(120);
columns.Bound(c => c.ExternalItemId).Title("External Id").Width(120);
columns.Bound(c => c.Name).Width(400);
columns.Bound(c => c.DeliveryDate).Width(140).Format("{0:MM/dd/yy}");
columns.Bound(c => c.PurchUnit).Width(75).Title("Unit");
columns.Bound(c => c.Quantity).Width(120).Format("{0:#,##0}");
columns.Bound(c => c.PurchasePrice).Width(100).Title("Price").Format("{0:$ #,##0.00}");
columns.Bound(c => c.LineAmount).Width(160).Hidden(true).IncludeInMenu(true).Format("{0:$ #,##0.00}");
columns.Bound(c => c.LineDiscount).Width(80).Hidden(true).IncludeInMenu(true);
columns.Bound(c => c.LinePercent).Width(80).Hidden(true).IncludeInMenu(true);
columns.Bound(c => c.ApprovalStatus).Width(130).EditorTemplateName("ApprovalStatusEditor").Title("Status");
columns.ForeignKey(c => c.ApprovalReasonId, (System.Collections.IEnumerable)ViewData["ApprovalReason"], "Id", "Description").Width(350).Title("Denied Code");
})
.ToolBar(toolbar =>
{
toolbar.Excel();
toolbar.Save();
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Pageable(p => p.PageSizes(true).PageSizes(new int[] {20,50,100,1000}))
.Navigatable()
.Filterable(filtering => filtering.Enabled(true))
.Groupable()
.Sortable(s => {
s.SortMode(GridSortMode.MultipleColumn);
s.AllowUnsort(true);
})
.ColumnMenu()
.Scrollable(scrollable => {
scrollable.Enabled(true);
scrollable.Height(700);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Model(model => {
model.Id(p => p.CompanyId);
model.Field(c => c.PurchId).Editable(false);
model.Field(c => c.LineNum).Editable(false);
model.Field(c => c.ItemId).Editable(false);
model.Field(c => c.ExternalItemId).Editable(false);
model.Field(c => c.Name).Editable(false);
model.Field(c => c.CurrencyCode).Editable(false);
model.Field(c => c.PriceUnit).Editable(false);
model.Field(c => c.Quantity).Editable(false);
model.Field(c => c.PurchUnit).Editable(false);
model.Field(c => c.PurchasePrice).Editable(false);
model.Field(c => c.DeliveryDate).Editable(false);
model.Field(c => c.LineAmount).Editable(false);
model.Field(c => c.LineDiscount).Editable(false);
model.Field(c => c.LinePercent).Editable(false);
})
.Read(read => read.Action("PurchaseJournalTransactions_Read", "Approval"))
.Update(update => update.Action("PurchaseJournalTransactions_Update", "Approval"))
)
)
<
br
/>
</
div
>