我正在尝试使用下面的代码设置我的DatePicker的值,并期望"更改"事件被提升但事实并非如此.
var datePicker = $("#datePicker").data("kendoDatePicker");
var previousDate = new Date(datePicker.value());
previousDate.setDate(previousDate.getDate() - 1);
$("#displayDate").text(kendo.toString(new Date(previousDate), 'D'));
datePicker.value(previousDate);
Run Code Online (Sandbox Code Playgroud)
通过用户界面更改日期值确实按预期引发"更改"事件.
我正在尝试使用KendoUI DropDownListFor作为我的模型外键并将其与ViewData/ViewBag完整列表绑定但似乎无法正常工作,我错过了什么?
@(Html.DropDownListFor(model => model.Hotel.HotelStatusId, ViewData["HotelStatuses"] as SelectList))
Run Code Online (Sandbox Code Playgroud)
这似乎工作,但要求我创建一个viewmodel.
@(Html.Kendo().DropDownListFor(model => model.Hotel.HotelStatusId)
.BindTo(Model.HotelStatuses)
.OptionLabel("select hotel status...")
)
Run Code Online (Sandbox Code Playgroud)
我正在避免使用viewmodel,因为我需要将数据提交回ASP MVC.使用自定义viewmodel,我无法正确绑定它.
我正在尝试添加对另一个项目(例如Elysium)中定义的资源库的引用,并在表达式混合中使用它.
以下是我在App.Xaml文件中合并资源字典的方法.
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro.Resources;component/Icons.xaml" />
<ResourceDictionary Source="pack://application:,,,/Telerik.Windows.Themes.Metro;component/Themes/System.Windows.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Run Code Online (Sandbox Code Playgroud)
但我似乎无法在Expression Blend 4中获得这些库中定义的任何画笔资源.任何想法?

我正在使用KendoUI Grid及其ASP MVC Complete Wrapper库,我在剃刀代码中设置网格高度时出现问题.我尝试设置HTMLAttribute但似乎不起作用.
@(Html.Kendo().Grid<SoftInn.Data.Country>()
.Name("grid-countries")
.DataSource(datasource => datasource.Ajax()
.Model(model => model.Id(record => record.Id))
.Create(create => create.Action("Add", "Country"))
.Read(read => read.Action("GetAll", "Country"))
.Update(update => update.Action("Update", "Country"))
.Destroy(delete => delete.Action("Delete", "Country"))
.Events(events =>
{
events.Sync("gridcountries_synchandler");
events.Error("gridcountries_errorhandler");
})
.PageSize(10)
)
.Columns(columns =>
{
columns.Bound(r => r.Name);
columns.Bound(r => r.Currency);
columns.Bound(r => r.TimeZone);
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(170);
})
.ToolBar(toolbar =>
{
toolbar.Create().Text("Add New Country");
toolbar.Custom().Text("Refresh").Url("#").HtmlAttributes(new { onclick = "window.refreshGrid($(this).parent().parent())", @class = "customRefreshButton" });
toolbar.Custom().Text("More").Url("#").HtmlAttributes(new { onclick = "window.toggleDisplay($('#grid-countries > .k-grouping-header'))", …Run Code Online (Sandbox Code Playgroud) 处理国际应用程序的客户端(javascript、ajax)和服务器(ASP MVC)之间的DateTime 格式的首选做法是什么?
根据我的研究:
使用自定义模型绑定器覆盖 ASP MVC 的 DateTime 模型绑定器,例如
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
{
try
{
var value = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);
return value.ConvertTo(typeof(DateTime), CultureInfo.InvariantCulture);
}
catch (Exception ex)
{
return new DateTime();
}
}
Run Code Online (Sandbox Code Playgroud)
并在客户端格式化日期:
function toISOString(d) {
var year = d.getFullYear();
var month = d.getMonth() + 1;
var date = d.getDate();
return year + '-' + month + '-' + date;
}
Run Code Online (Sandbox Code Playgroud)
最后一个问题 - 设置了上述内容后,如果在进入应用程序之前必须考虑,服务器如何检查客户端的日期时间偏移量或时区偏移量?
我正在使用KendoUI网格并使用其ToDataSourceResult来过滤我的数据(如文档所示),但我担心性能影响.
根据我的理解,下面建议的代码从数据库获取所有记录到内存和performm ToDataSourceResult扩展方法来过滤内存中的记录(LINQ流畅的api概念).如果我有很多记录,这会对性能产生很大影响吗?
我认为对数据库进行查询,前面的"where"子句会有更好的性能......请指教.
这是文档中建议的内容
var countries = _database.Countries.GetAll();
return Json(countries.ToDataSourceResult(request, record => new
{
record.Id,
record.Name,
record.Currency,
record.TimeZone
}));
Run Code Online (Sandbox Code Playgroud)
这是不使用ToDataSource过滤器的其他选项
var selectedCountries = _database.Countries.GetCountryStartWith("m")
Run Code Online (Sandbox Code Playgroud) 我需要帮助将我的下拉列表的KendoUI DataSource从GET请求更改为POST请求.
@(Html.Kendo().DropDownListFor(m => m.Id)
.Name("PVDropDownList_Hotel")
.DataSource(datasource =>
{
datasource.Read("GetMyHotels", "Hotel");
})
.DataTextField("Name")
.DataValueField("Id")
.Events(events =>
{
events.Change("PVDropDownList_Hotel_OnChange");
events.Select("PVDropDownList_Hotel_OnSelect");
})
.AutoBind(false)
Run Code Online (Sandbox Code Playgroud)
)
在我的 Typescript AngularJS 控制器中声明了以下构造函数。
static $inject: Array<string> = [
'$rootScope',
'BookingRepository'
];
constructor(
$rootScope: ng.IRootScopeService,
bookingRepository: soft.data.BookingRepository
) {
super();
this.$rootScope = $rootScope;
this.$rootScope.$on('accessController_onNavAccessSelected', this.accessController_onNavAccessSelected);
this.bookingRepository = bookingRepository;
}
Run Code Online (Sandbox Code Playgroud)
但是当 accessController_onNavAccessSelected 被调用时,当我引用“this”时,我得到了空值。我期待控制器的实例。
// Listening Events
accessController_onNavAccessSelected(event: ng.IAngularEvent, accessViewModel: soft.data.AccessViewModel): void {
console.log(this);
}
Run Code Online (Sandbox Code Playgroud)
我错过了什么?或者我如何获得我的控制器实例的引用?
kendo-ui ×5
asp.net-mvc ×2
ajax ×1
angularjs ×1
datetime ×1
javascript ×1
telerik ×1
typescript ×1
wpf ×1