<ej:Grid ID="Grid" runat="server" AllowPaging="True">
-----------------------------------
<ClientSideEvents ActionComplete="complete" />
<Columns>
------------------------
<ej:Column Field="ShipCity" HeaderText="Ship City" Width="90" EditType="Dropdown">
<ValidationRule>
<ej:KeyValue Key="required" Value="true" />
</ValidationRule>
</ej:Column>
---------------------
</Columns>
</ej:Grid>
<script>
function complete(args) {
if (args.requestType == "beginedit" || args.requestType == "add") {
var old = $("#" + this._id + "EditForm").validate().settings.errorPlacement;
$("#" + this._id + "ShipCity").ejDropDownList({
select: function (args) {
$(this.element.closest(".e-ddl")).siblings(".e-error").remove();
}
})
var proxy = this;
$("#" + this._id + "EditForm").validate().settings.errorPlacement = function (error, element) {
if (element.attr("ID") == proxy._id + "ShipCity") {
$container = $(error).addClass("e-error");
$tail = ej.buildTag("div.e-errortail e-toparrow");
$container.append($tail);
$container.offset({ left: $(element).parent().position().left + $(element).closest("td").width() });
$container.insertBefore(element.closest(".e-widget"))
}
else
old.apply(this, [error, element]);
}
}
}
</script> |
<ej:Grid ID="Grid" runat="server" AllowPaging="True">
<Columns>
……………………………..
<ej:Column Field="Freight" HeaderText="Freight" TextAlign="Right" Width="80" Format="{0:C}" EditType="Numeric">
<NumericEditOptions DecimalPlaces="2"></NumericEditOptions>
<ValidationRule>
<ej:KeyValue Key="required" Value="true" />
</ValidationRule>
</ej:Column>
<ej:Column Field="ShipCity" HeaderText="Ship City" Width="90" EditType="Dropdown">
<ValidationRule>
<ej:KeyValue Key="required" Value="true" />
</ValidationRule>
</ej:Column>
……………………………………………………………………………..
</Columns>
</ej:Grid>
<script>
function complete(args) {
if (args.requestType == "beginedit" || args.requestType == "add") {
var old = $("#" + this._id + "EditForm").validate().settings.errorPlacement;
$("#" + this._id + "ShipCity").ejDropDownList({
select: function (args) {
$(this.element.closest(".e-ddl")).siblings(".e-error").remove();
}
})
var proxy = this;
$("#" + this._id + "EditForm").validate().settings.errorPlacement = function (error, element) {
if (element.attr("ID") == proxy._id + "ShipCity" || element.attr("ID") == proxy._id + "Freight" ) {
$container = $(error).addClass("e-error");
$tail = ej.buildTag("div.e-errortail e-toparrow");
$container.append($tail);
$container.offset({ left: $(element).parent().position().left + $(element).closest("td").width() });
$container.insertBefore(element.closest(".e-widget"))
}
else
old.apply(this, [error, element]);
}
}
}
</script>
</asp:Content> |