Hi
please i have create my grid and set bootstrap theme to it and add 3 custom button on it and every thing works fine but buttons not centered in each grid cell it's align to right (i have add rtl css) as you can see in attached image
so please how can i set them center vertically and Horizontally in each grid cell ?
my attempt (Where I have Kendo DropDownList 1 as #Type and Kendo DropDownList 2 as #Units:
$('#Type').change(function (e) {
//if (e.target.value == "Electirc") {
var val = e.target.value;
var ddL = $('#Units').data("kendoDropDownList")
if (val == "Electric") {
ddl.dataSource.data({Text:"-", value:"null"},{Text:"kW", value:"kW"},{Text:"GJ", value:"GJ"})
//$("#Units").html("<option value='null'>item1:-</option><option value='kW'>item1: kW</option><option value='GJ'>item1: GJ</option>");
}
})
The goal would be to have the contents of DDL2 to change based on the selection by DDL1
I'm starting to build a Telerik UI for ASP.NET MVC project, just like the Grid Demo on http://demos.telerik.com/aspnet-mvc/
And i got this error when i debug project.
What problem?
I am using UI for MVC 2015.1.318
I am replacing user admin lists with Telerik grids, but need to call the original views for CRUD. I have reviewed the documentation at http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/grid/server-editing as well as several forum posts, but the Edit command button always calls the inline editor.
My grid
@(Html.Kendo().Grid(Model.UsersList) .Name("grid") .Columns(columns => { columns.Bound(u => u.DisplayName); columns.Bound(u => u.AccountName); columns.Bound(u => u.Email); columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200); }) .Editable(editable => editable.Mode(GridEditMode.InLine)) .Pageable() .Sortable() .Scrollable() .DataSource(dataSource => dataSource .Ajax() .ServerOperation(false) .PageSize(20) .Sort(sort => sort.Add("AccountName").Ascending()) .Model(model => model.Id(u => u.UserId)) .Update(update => update.Action("Edit", "UserAdmin")) .Destroy(destroy => destroy.Action("Delete", "UserAdmin")) ))There is a UserAdminController.cs with Edit and Delete methods. Here is the Edit:
public async Task<ActionResult> Edit(string id){ if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } var editUser = await UserManager.FindByIdAsync(id); if (editUser == null) { return HttpNotFound(); } UserDetailsViewModel vm = new UserDetailsViewModel() { Id = editUser.Id, Email = editUser.Email, DisplayName = editUser.DisplayName, SelectedAccountId = editUser.AccountId, }; // System Admins can assign Account to users, so get a list if (User.IsInRole("System Admin")) { vm.AvailableAccounts = DataRepo.GetAccountListForDdl().ToList(); } await Edit_SetupRoles(editUser.Id, vm); vm.ProviderId = editUser.ProviderId; if (editUser.ProviderId != null) vm.ProviderName = DataRepo.GetProviderName(editUser.ProviderId); vm.AccessLevelsAssigned = DataRepo.GetAssignedUserAccessLevels(editUser.Id); vm.AccessLevelsPool = DataRepo.GetAvailableUserAccessLevels(editUser.Id, editUser.AccountId); vm.AccountAndClients = DataRepo.GetAccountAndClientListForDdl(editUser.AccountId).ToList(); return View(vm);}Where is this going off the rails?
Best,
Scott
I'm adding an item and then wanting to refresh the TreeView. It works every other time. The node is always added, but the treeview is refreshed to display it only after I click to add another node. At that time, both new nodes show up. I'm guessing that the first ajax call hasn't completed when the treeview.dataSource.read() statement is reached. Is there a way to execute a "wait" until the AddNode statement has completed?
Here's my javascript:
// Add Node$("#createCategory").click(function () { var name = $("#newCategory").val(); if (name != "") { $.ajax({ url: '@Url.Action("AddNode","Categories")', type: "POST", data: { CategoryName: name } }); kendoConsole.log("Adding " + name); //var treeview = $("#treeview").data("kendoTreeView"); treeview.dataSource.read(); } else { kendoConsole.log("Please enter non-empty name"); } $("#newCategory").val("") $("#newCategory").focus()});Hi
i have download nice Tools knedo ui and try to use Grid in MVC - it works fine but i have two problems and i don't know how to resolve them
1. i can't get filed from joined table to let me display text filed in my grid as example (Supplier table is joined to Products table in SupplierID) but i can't view CompanyName in my grid i try it as:
columns.Bound(o => o.Supplier).ClientTemplate("#=Supplier.CompanyName#").Width(160);but it make grid now working ?
2. i need to insert dropdownlist in my grid that contain Supplier ID and "CompanyName" but it now working for me too i try add:
model.Field(o => o.SupplierID).DefaultValue(ViewData["defaultCategory"] as AjaxHierarchyEditing.Models.Supplier);and fill ViewData in Home Controller
my full Code is:
HTML Code:
<div class="k-rtl"> <script type="text/kendo" id="productsTemplate"> @(Html.Kendo().Grid<ProductViewModel>() .Name("Categories_#=CategoryID#") .Columns(columns => { columns.Bound(o => o.ProductName).Width(101).Title("اسم الصنف"); columns.Bound(o => o.UnitPrice).Width(140).Title("سعر الوحده").HeaderHtmlAttributes(new { style = "font-size:12pt;" }); columns.Bound(o => o.QuantityPerUnit).Width(200).Title("الكميه للوحده"); columns.Bound(o => o.ReorderLevel).Width(200).Title("مستوي اعاده الطلب"); columns.Bound(o => o.Supplier).ClientTemplate("#=Supplier.CompanyName#").Width(160); columns.Command(command => { command.Edit(); command.Destroy(); }); }) .ToolBar(tools => tools.Create().Text("اضافه صنف جديد")) .Editable(editable => editable.Mode(GridEditMode.PopUp)) .Pageable() .Sortable() .Filterable() .DataSource(source => source .Ajax() .Model(model => { model.Id(o => o.ProductID); model.Field(o => o.ProductID).Editable(false); model.Field(o => o.SupplierID).DefaultValue(ViewData["defaultCategory"] as AjaxHierarchyEditing.Models.Supplier); }) .Events(events => events.Error("error_handler")) .Read(read => read.Action("Read_Product", "products", new { id = "#=CategoryID#" })) .Update(update => update.Action("Update_Product", "products")) .Create(create => create.Action("Create_Product", "products", new { id = "#=CategoryID#" })) .Destroy(destroy => destroy.Action("Destroy_Product", "products"))) .ToClientTemplate() ) </script></div><div class="k-rtl"> @(Html.Kendo().Grid<Category>() .Name("Categories_") .Columns(columns => { columns.Bound(e => e.CategoryName).Width(200).Title("اسم المجموعه"); ; columns.Bound(e => e.Description).Width(400).Title("الوصف"); ; columns.Command(command => { command.Edit(); command.Destroy(); }); }) .ToolBar(tools => tools.Create().Text("اضافه مجموعه جديده")) .Editable(editable => editable.Mode(GridEditMode.PopUp)) .Pageable().Sortable().Filterable() .DataSource(source => source.Ajax() .Model(model => { model.Id(e => e.CategoryID); }) .Events(events => events.Error("error_handler")) .Read(read => read.Action("Read_category", "kinds")) .Update(update => update.Action("Update_category", "kinds")) .Create(create => create.Action("Create_category", "kinds")) .Destroy(destroy => destroy.Action("Destroy_category", "kinds"))) .ClientDetailTemplateId("productsTemplate") )</div><script type="text/javascript"> function error_handler(e) { productsTemplate if (e.errors) { var message = "Errors:\n"; $.each(e.errors, function (key, value) { if ('errors' in value) { $.each(value.errors, function () { message += this + "\n"; }); } }); alert(message); } }</script>Home Controller Code:
public ActionResult Index(){ PopulateCategories(); return View();} private void PopulateCategories(){ ViewData["defaultCategory"] = new SelectList(context.Suppliers, "SupplierID", "CompanyName");}Product Controller Read Code:
public ActionResult Read_Product([DataSourceRequest] DataSourceRequest request, int id){ return Json(context.Products.Where(i => i.CategoryID == id).ToDataSourceResult(request, e => new ProductViewModel { ProductID = e.ProductID, ProductName = e.ProductName, QuantityPerUnit = e.QuantityPerUnit, UnitPrice = e.UnitPrice, ReorderLevel = e.ReorderLevel, SupplierID = e.SupplierID, }));}
public ProductViewModel() { this.Order_Details = new HashSet<Order_Detail>(); this.units = new HashSet<unit>(); } public int ProductID { get; set; } public string ProductName { get; set; } public Nullable<int> SupplierID { get; set; } //public Nullable<int> CategoryID { get; set; } public string QuantityPerUnit { get; set; } public Nullable<decimal> UnitPrice { get; set; } public Nullable<short> UnitsInStock { get; set; } public Nullable<short> UnitsOnOrder { get; set; } public Nullable<short> ReorderLevel { get; set; } //public bool Discontinued { get; set; } //public string EAN13 { get; set; } public virtual Category Category { get; set; } public virtual ICollection<Order_Detail> Order_Details { get; set; } public virtual Supplier Supplier { get; set; } public virtual ICollection<unit> units { get; set; }}so please how can i resolve those problems ?
Hi
Please sir, i have add barcode in my view and it works as code:
@(Html.Kendo().Barcode() .Name("manchego") .Value("2346722") .Encoding(BarcodeSymbology.EAN8) .Width(200) .Height(100))now i need to pass value to barcode from EmployeeViewModel for each employee to let me view them in my page as example :
<ul id="dairy"> <li>@* here pass value for employee 1 *@@(Html.Kendo().Barcode().Name("manchego").Value("2346722").Encoding(BarcodeSymbology.EAN8).Width(200).Height(100)) </li> <li>@* here pass value for employee 2 *@@(Html.Kendo().Barcode().Name("mascarpone").Value("Mascarpone").Encoding(BarcodeSymbology.Code128).Width(200).Height(100)) </li> <li>@* here pass value for employee 3 *@@(Html.Kendo().Barcode().Name("gudbrands").Value("CHEESE").Encoding(BarcodeSymbology.Code39).Width(200).Height(100)) </li> </ul>and ect ..... for any other employee
so please how can i do that ?
Could I get another SignalR example, where the scheduler hub is called from another controller? Here's my workflow:
1. big screen shows day's schedule
2. user schedules work order from other page
3. after saving change, call Hub.Clients.All.update(updatedItem)
4. big screen scheduler updates
I have the following code that I am trying to use to delete an item in the database when someone clicks the delete button:
<script id="treeview-template" type="text/kendo-ui-template"> #: item.name # <a href="javascript:void(0)" class='btn-sm btn-danger' onclick="DeleteNode(@item.id)">x</a> </script> @Html.Kendo().TreeView().Name("Categories").ExpandAll(true).Template("treeview-template").DataSource(dataSource => dataSource.Model(model => model.Id("id") .HasChildren("hasChildren") ) .Read(read => read.Action("GetCategories", "Categories"))).DataTextField("name").DragAndDrop(true).Checkboxes(true).Events(events => events.Change("onChange").Select("onSelect").Check("onCheck").Collapse("onCollapse").Expand("onExpand").DragStart("onDragStart").Drag("onDrag").Drop("onDrop").DragEnd("onDragEnd"))The issue I'm having is that the field I'm trying to pass to the function, @item.id, is causing the exception: "The name 'item' does not exist in the current context." How can I format the code so this works?
Thanks.
Laurie