Hi everyone,
I've created a Grid Hierarchy here..I was able to get the column values from my Parent Grid(CustomerGrid) to use it on a ClientTemplate for example
(@Html.ActionLink(
"Add Order"
,
"AddOrder"
,
"Customer"
,
new
{ customerId =
"#= CustomerId#"
},
null
).ToHtmlString()).
But when I'm trying to adapt this kind of code, now getting the customerOrderId field from my Child Grid and use it on my ClientTemplate for example
(@Html.ActionLink(AmsStrings.LabelEditAmendment,
"EditOrder"
,
"CustomerOrder"
,
new
{ orderId =
"#= OrderId#"
},
null
).ToHtmlString())
@(Html.Kendo().Grid<customerviewmodel>
()
.Name(
"CustomerGrid"
)
.Columns(columns =>
{
columns.Bound(item => item.CustomerId).Hidden(
true
);
columns.Bound(item => item.Name);
columns.Template(t => { })
.Title(
""
)
.Width(120)
.ClientTemplate("<div
class
=
'btn-group'
>
" +
"<a class='btn btn-default btn-sm dropdown-toggle' data-toggle='dropdown'> Action <span class='caret'></span></a>"
+
"<ul
class
=
'dropdown-menu'
>
" +
"
<li>
" + (@Html.ActionLink("
Add Order
", "
AddOrder
", "
Customer
", new { customerId = "
#= CustomerId#
" }, null).ToHtmlString()) + "
</li>" +
"
</ul>
</div>");
})
.Selectable(selectable =>
{
selectable.Enabled(
true
);
selectable.Mode(GridSelectionMode.Single);
})
.ClientDetailTemplateId(
"template"
)
.DataSource(datasource => datasource.Ajax()
.Model(model =>
{
model.Id(m => m.CustomerId);
})
.Read(read => read.Action(
"CustomerDataSource"
,
"Customer"
)))
.Sortable())
<script id=
"template"
type=
"text/x-kendo-template"
>
@(Html.Kendo().Grid
<CustomerOrderViewModel>
()
.Name(
"grid_#=CustomerId#"
)
.Columns(columns =>
{
columns.Bound(item => item.OrderId).Hidden(
true
);
columns.Bound(item => item.OrderName);
columns.Template(@<text></text>)
.Title(
""
)
.Width(100)
.ClientTemplate("<div
class
=
'btn-group'
>
" +
"<a class='btn btn-default btn-sm dropdown-toggle' data-toggle='dropdown'>Action<span class='caret'></span></a>"
+
"<ul
class
=
'dropdown-menu'
>
" +
"
<li>
" + (@Html.ActionLink("
Edit
", "
EditOrder
", "
CustomerOrder
", new { orderId = "
#= OrderId#
" }, null).ToHtmlString()) + "
</li>" +
"
<li>
" + (@Html.ActionLink("
View
", "
ViewOrder
", "
CustomerOrder
", new { orderId = "
#= OrderId#
" }, null).ToHtmlString()) + "
</li>" +
"
</ul>
</div>");
})
.Editable(editable => editable.Enabled(
false
))
.Sortable()
.Selectable(selectable =>
{
selectable.Enabled(
true
);
selectable.Mode(GridSelectionMode.Single);
})
.DataSource(datasource => datasource
.Ajax()
.ServerOperation(
false
)
.PageSize(5)
.Model(model => model.Id(p => p.OrderId))
.Read(read => read.Action(
"CustomerOrderDataSource"
,
"CustomerOrder"
,
new
{ customerOrderId =
"#=customerId#"
})))
.ToClientTemplate())
</script>
I found out that defining "Editable(false)" for a model field doesn't seem to work when I've chosen GridEditMode.PopUp:
@(Html.Kendo().Grid<Pharmacy>()
.Columns(columns => ...)
.Editable(editable => editable.Mode(GridEditMode.PopUp))
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(p => p.Id);
model.Field(p => p.Id).Editable(
false
);
model.Field(p => p.MyReadOnlyField).Editable(
false
);
}))
)
In this case, the "Id" field and the "MyReadOnlyField" field will be shown in the popup as editable - which obviously is not the expected behavior.
Is this done intentional or is it a bug that Model definition doesn't work correctly with PopUp edit mode? Of course I can define a custom template, but that's not what I really want... from my view it's a bug or missing feature.
Thanks in advance,
Dimitrij
Does ASP.NET MVC scheduler support integration with google calender or outlook?
Thank you..
Hi,
I'm Thinking of moving from kendo ui html5 to the mvc version but I am worried about performance problem when moving to large scale (2,000,000 + users per month)
Has anybody experienced issues with the MVC edition of kendo that might not happen in the Kendo UI html5 version?
Thanks
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