Hello,
the AuthorizeAttribute does for well initial authorization and authentication and for actions that return views, but it doesn't work for grid commands such as save. Well it actually prevent the saving process, but the routing to the error-action doesn't work properly, because the save-command doesn't expect a view to be returned.
Rather than redirecting I'd like to hide commands/toolbar-items based on the role a user has in our database, but so far I only found an option like this based on AD-roles. Is there any way for me to do this?
I cannot create a grid in my MVC 6 application. I get "The kendo.aspnetmvc.min.js script is not included."
I am trying to run with the 30-day trial. I cannot find that js in the lib folder.
Hi,
I am using Custom Editor Template in my Scheduler. Can you please tell me as how to include tab in the Custom Editor Template?
When trying to add tab using below code
<
div
id
=
"tabExample"
style
=
"float:left;width:98%;font-size: 1.1em !important;"
>
<
ul
>
<
li
><
a href="#tab1"
>Tab1</
a
></
li
>
<
li
><
a href="#tab2"
>Tab2</
a
></
li
>
</
ul
>
</
div
>
//And in Script
<
script
type
=
"text/javascript"
>
$(document).ready(function () {
$("#tabExample").tabs();
});
</
script
>
I am getting javascript error like "Invalid Template".
Can you help me on this.
Thanks,
Dilip
I tried this sample code from here: http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/spreadsheet/overview
and I don't get anything that renders on the view. I am also wondering where I can find some advanced examples of the spreadsheet control as I need to be able to freeze panes disable tool bar items or make them not show and so on.
Regards.
My dates pickers are showing no values when loaded, if I look at source I can see that they have a value, but it is not showing. you can see below that value is present.
HTML generated
<
span
class
=
"k-widget k-datepicker k-header"
><
span
class
=
"k-picker-wrap k-state-default"
><
input
name
=
"StartDate"
class
=
"k-input"
id
=
"StartDate"
role
=
"combobox"
aria-disabled
=
"false"
aria-expanded
=
"false"
aria-readonly
=
"false"
aria-owns
=
"StartDate_dateview"
style
=
"width: 100%;"
type
=
"text"
value
=
"2015/09/05"
data-role
=
"datepicker"
data-val-required
=
"The StartDate field is required."
data-val
=
"true"
data-val-date
=
"The field StartDate must be a date."
><
span
class
=
"k-select"
role
=
"button"
aria-controls
=
"StartDate_dateview"
unselectable
=
"on"
><
span
class
=
"k-icon k-i-calendar"
unselectable
=
"on"
>select</
span
></
span
></
span
></
span
>
MVC config
@Html.Kendo().DatePickerFor(Function(m) m).Format("yyyy/MM/dd").ParseFormats({"dd-MM-yyyy", "dd/MM/yyyy", "MM/dd/yyyy", "yyyy/MM/dd", "yyyy-MM-dd"}).Value(Model)
Thanks
Hi, i am using MVC CHART CONTROL. Is it possible set the categoryAxis title according to a dropdown list's selected value.
when the user click the update button, It will call
var ochart = $("#chart").data("kendoChart");
ochart.dataSource.read();
that works well and chart area will be updated accoriding settings. based on it, I would like to change the axis title as well. but if i tried to
ochart.options.categoryAxis.title = "something else";
the title just disappeared.
I have spent a few hours on it. please anyone can give me a hand?
thanks
Hello everyone,
Currently I've got three ComboBoxes:
When user selects a country the next two ComboBoxes will show some values based on the first value. Example:
If country is "United States", the state will show all of the states in the U.S and city will show all of the cities in the U.S.. What I need to do this is to add another condition to select cities based on State if available because not all countries have states.
Following is my code for Cities:
public JsonResult GetCascadeCities(string countries, string states, string cityFilter)
{
var cities = db.GeoDD.AsQueryable();
if (countries != null)
{
cities = cities.Where(p => p.CountryCode == countries);
}
if (!string.IsNullOrEmpty(cityFilter))
{
cities = cities.Where(p => p.City.Contains(cityFilter));
}
return Json(cities.Where(p => p.Deleted == false).Select(p => new { City = p.City }).Distinct().OrderBy(p => p.City), JsonRequestBehavior.AllowGet);
}
So how can I make it so that if a country has state then city should be populated based on Country and State and if not then Country should be the only condition.
Please advice,
Alex
Im having problems getting the multi select change event to fire.
Initially i thought it could be something to do with my functions so i've tried copying all the event functions exactly as shown on the demo page.
Using the multi select box, i can see all the events are firing EXCEPT for the change event. (e.g. open, selected, closed, databound works)
Is there any reason why only the change function is not firing? I need the change function as theres logic to be done when an item is selected or deleted from the list.
This is what my multi select looks like:
01.
@(Html.Kendo().MultiSelectFor(m => m.Ids)
02.
.DataTextField("Description")
03.
.DataValueField("Id")
04.
.Filter("contains")
05.
.Placeholder("Please select an item...")
06.
.Events(e => e.Change("onChange").Select("onSelect").Open("onOpen").Close("onClose").DataBound("onDataBound").Filtering("onFiltering"))
07.
.DataSource(source =>
08.
{
09.
source.Custom()
10.
.ServerFiltering(true)
11.
.ServerPaging(true)
12.
.PageSize(80)
13.
.Type("aspnetmvc-ajax")
14.
.Transport(transport =>
15.
{
16.
transport.Read("GetItems", "Items");
17.
})
18.
.Schema(schema =>
19.
{
20.
schema.Data("Data").Total("Total");
21.
});
22.
})
23.
.Virtual(v => v.ItemHeight(26).ValueMapper("itemsValueMapper"))
24.
.Value(Model.Items)
25.
)
And javascript is just your basic event functions
01.
function onOpen() {
02.
console.log("event: open");
03.
}
04.
05.
function onClose() {
06.
console.log("event: close");
07.
}
08.
09.
function onChange() {
10.
console.log("event: change");
11.
}
12.
13.
function onDataBound() {
14.
console.log("event: dataBound");
15.
}
16.
17.
function onFiltering() {
18.
console.log("event: filtering");
19.
}
20.
21.
function onSelect(e) {
22.
var dataItem = this.dataSource.view()[e.item.index()];
23.
console.log("event :: select (" + dataItem.Text + " : " + dataItem.Value + ")");
24.
}
Thanks
This grid works for Read, Update (of existing record only) and Delete, but when Creating a new row, the Update button doesn't work. (When creating a new row, the Cancel button does work).
e.g.
After Reading data from server:
- Click Edit button on existing row. Make changes. Click Update. Success!
- Click Delete button on existing row. Success!
- Click Add new record button. New row appears. Click Cancel. Success!
- Click Add new record button. New row appears. Click Update. Nothing happens. Controller method is not called.
What is wrong?
Thanks
Grid:
@(Html.Kendo().Grid<
PublicUserMunicipalityViewModel
>()
.Name("publicUserMunicipalitiesGrid")
.Columns(columns =>
{
columns.Bound(u => u.Id).Hidden();
columns.Bound(u => u.PublicUserId).Hidden();
columns.Bound(u => u.UserId).Hidden();
columns.Bound(u => u.muni_code).Hidden();
columns.Bound(u => u.Municipality).ClientTemplate("#=Municipality.MuniCombo#");
columns.Bound(u => u.RequestedDate).Hidden();
columns.Bound(u => u.Granted).Hidden();
columns.Bound(u => u.CanSubmitForms).ClientTemplate("<
input
type
=
'checkbox'
disabled
=
'disabled'
#= CanSubmitForms ?
checked
=
'checked'
: '' # ></
input
>");
columns.Bound(u => u.SuperUser).ClientTemplate("<
input
type
=
'checkbox'
disabled
=
'disabled'
#= SuperUser ?
checked
=
'checked'
: '' # ></
input
>");
columns.Bound(u => u.IsCurrent).Hidden();
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(180);
})
.ToolBar(toolbar => toolbar.Create())
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(p => p.Id);
model.Field(p => p.Id);
model.Field(p => p.PublicUserId);
model.Field(p => p.UserId);
model.Field(p => p.muni_code);
model.Field(p => p.Municipality).DefaultValue(ViewData["defaultMunicipality"] as MunicipalityViewModel);
model.Field(p => p.RequestedDate);
model.Field(p => p.Granted);
model.Field(p => p.CanSubmitForms);
model.Field(p => p.SuperUser);
model.Field(p => p.IsCurrent);
})
.Read(read => read.Action("PublicUserMunicipalityViewModelsRead", "PublicUserMunicipalityViewModels")
.Data("getSelectedPublicUserId"))
.Create(create => create.Action("PublicUserMunicipalityViewModelsCreate", "PublicUserMunicipalityViewModels")
.Data("getSelectedPublicUserId"))
.Update(update => update.Action("PublicUserMunicipalityViewModelsUpdate", "PublicUserMunicipalityViewModels"))
.Destroy(destroy => destroy.Action("PublicUserMunicipalityViewModelsDestroy", "PublicUserMunicipalityViewModels"))
)
)
Controller Method:
public ActionResult PublicUserMunicipalityViewModelsCreate([DataSourceRequest]DataSourceRequest request, PublicUserMunicipalityViewModel publicUserMunicipalityViewModel, int publicUserId)
{
// Set UserId and PublicUserId
publicUserMunicipalityViewModel.PublicUserId = publicUserId;
var publicUser = db.PublicUsers.FirstOrDefault(pu => pu.Id == publicUserId);
publicUserMunicipalityViewModel.UserId = publicUser.UserId;
// Clear the ModelState errors these two required fields had as they were passed in null.
ModelState["PublicUserID"].Errors.Clear();
ModelState["UserID"].Errors.Clear();
if (ModelState.IsValid)
{
// Create a new PublicUserMunicipality entity and set its properties from the posted PublicUserMunicipalityViewModel
var entity = this.BuildPublicUserMunicipalityEntity(publicUserMunicipalityViewModel);
// Add the entity
db.PublicUserMunicipalities.Add(entity);
// Delete the entity in the database
db.SaveChanges();
// Get the Id generated by the database
publicUserMunicipalityViewModel.Id = entity.Id;
}
// Return the inserted contract. Also return any validation errors.
return Json(new[] { publicUserMunicipalityViewModel }.ToDataSourceResult(request, ModelState));
}
Hi ,
i have an issue with telerikTimePicker it is really random one . when the client try to select a time from the time picker it only show two selection 12:00 AM and 12:00 AM when he refresh the page it show the whole list from 12:00 Am till 11:45 PM . this only happen in mobile devices found in both android and apple devices
this is a screenshot
http://screencast.com/t/9kZW4V3IP98y