Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
142867 | Feb 23,2019 07:54 AM UTC | Feb 25,2019 11:59 AM UTC | ASP.NET MVC | 1 |
![]() |
Tags: Grid |
<script type="text/javascript">
if ($("#cars").data("ejDropDownList").getSelectedValue() == undefined) {
var gridObj = $("#GridParameters").ejGrid("instance");
gridObj.option({toolbarSettings: { showToolbar: false }}) // using setModel method change the visibility of the toolbar.
}
</script>
|
@(Html.EJ().Grid<Object>("FlatGrid")
….
.Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).ValidationRules(v => v.AddRule("required",true)).Add();
…………..
}))
|
$(function () {
……………..
$.validator.addMethod("customRegex", function (value, element, params) {
if (element.value.length == params) // the value 5 is compared with the entered text length
return true;
return false;
}, "Customer ID must be 5 characters");
@(Html.EJ().Grid<Object>("FlatGrid")
.Datasource((IEnumerable<object>)ViewBag.DataSource)
.AllowPaging()
.EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); })
.ToolbarSettings(toolbar =>
{
toolbar.ShowToolbar().ToolbarItems(items =>
{
items.AddTool(ToolBarItems.Add);
items.AddTool(ToolBarItems.Edit);
items.AddTool(ToolBarItems.Delete);
items.AddTool(ToolBarItems.Update);
items.AddTool(ToolBarItems.Cancel);
});
})
.Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).Add();
col.Field("CustomerID").HeaderText("Customer ID").ValidationRules(v => v.AddRule("customRegex", 5)).Add(); // the value 5 is the params here.
………….
}))
|
@(Html.EJ().Grid("GridParameters")
……………………..
.AllowSearching()
.SearchSettings(search =>
{
search.Fields(field =>
{
field.Add("UserID");
field.Add("UserName");
});
search.Key("Alex");
})
.Columns(col =>
{
……………
)
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.