草庐IT

data-binding-compiler

全部标签

c# - ASP.NET MVC 模型在表单元素名称中使用破折号进行绑定(bind)

我一直在互联网上搜索,试图找到一种方法来将我的表单元素中的破折号容纳到MVC2、3甚至4中ASP.NETController的默认模型绑定(bind)行为中。作为一名前端开发人员,我更喜欢CSS中的破折号,而不是驼峰式命名法或下划线。在我的标记中,我希望能够做的是这样的:在Controller中,我将传递一个如下所示的C#对象:publicclassPerson{publicstringFirstName{get;set;}publicstringLastName{get;set;}//etc...}是否有某种方法可以扩展Controller类以通过某些正则表达式或其他行为来适应这种情

c# - 接口(interface)继承多个接口(interface) : how is this handled by a C# compiler?

最近我发现C#允许Aninterfacecaninheritfromoneormorebaseinterfaces.例如,Caliburn.Micro中的IScreen在http://caliburnmicro.codeplex.com/SourceControl/latest#src/Caliburn.Micro/IScreen.cs中执行此操作namespaceCaliburn.Micro{publicinterfaceIScreen:IHaveDisplayName,IActivate,IDeactivate,IGuardClose,INotifyPropertyChangedE

c# - 使用 MVVM 的 WPF ComboBox 双向绑定(bind)问题

我有一个Activity具有许多属性的对象。其中之一如下:publicActivityStatusStatus{get{returnstatus;}set{status=value;NotifyPropertyChanged("Status");}}ActivityStatus类只有两个属性:publicGuidGuid{get{returnguid;}set{guid=value;NotifyPropertyChanged("Guid");}}publicstringName{get{returnname;}set{name=value;NotifyPropertyChanged("

c# - 在 .Net 4.0 中从 .Net 4.5 绑定(bind)的延迟属性

如何在.Net4.0中实现.Net4.5的延迟属性(描述here)?我知道我无法从BindingBase继承,因为ProvideValue是密封的。我可以实现MarkupExtension,但这意味着我现在必须重写BindingExtension的所有属性,还有其他方法吗? 最佳答案 最后,我决定使用组合将DelayedBinding实现为MarkupExtension。我遇到的唯一问题是如果IProvideValueTarget中的TargetProperty为null,DataTemplatesProvideValue应该返回此

c# - "Data Source cannot be empty. Use :memory: to open an in-memory database"是什么意思?

我最近将我的SQLServer数据库转换为SQLite数据库。但是当我尝试使用.Open()打开我的SQLite时,它​​抛出了这个错误:DataSourcecannotbeempty.Use:memory:toopenanin-memorydatabase编辑:添加连接字符串:ConnectionString=@"DataSource=D:\XXX.db;Version=3";connection=newSQLiteConnection(connectionString);connection.Open();为什么我会得到这个?我将相同的SQLServer数据库转换为SQLCE和my

c# - MVC 3 不绑定(bind) nullable long

我创建了一个测试网站来调试我遇到的问题,看来我传递的JSON数据有误,或者MVC无法绑定(bind)可为null的long。当然,我使用的是最新的MVC3版本。publicclassGetDataModel{publicstringTestString{get;set;}publiclong?TestLong{get;set;}publicint?TestInt{get;set;}}[HttpPost]publicActionResultGetData(GetDataModelmodel){//Dostuff}我正在发布一个具有正确JSON内容类型的JSON字符串:{"TestStri

c# - 扩展 System.Data.Linq.DataContext

我有一个反射(reflect)我的dbml文件的类,它扩展了DataContext,但由于某些奇怪的原因,它告诉我System.Data.Linq.DataContext'doesnotcontainaconstructorthattakes'0'arguments"我已经按照各种教程进行操作,但没有遇到这个问题,而且VS似乎无法修复它。这是我的实现usingSystem;usingSystem.Collections.Generic;usingSystem.Data;usingSystem.Data.Linq;usingSystem.Data.Linq.Mapping;usingSy

c# - 如何将 DataTable 绑定(bind)到 DataGrid

这是我的数据表。DataTable_simpleDataTable=newataTable();varperson=newDataColumn("Person"){DataType=typeof(Person)};_simpleDataTable.Columns.Add(person);varstudent=newDataColumn("Student"){DataType=typeof(Student)};_simpleDataTable.Columns.Add(student);vardr1=_simpleDataTable.NewRow();dr1[0]=newPerson{Pe

c# - 将大量数据绑定(bind)到组合框?

我想在下拉列表中绑定(bind)员工列表,具有自动完成功能,以便用户可以搜索正确的名称。我使用RadComboBox我有两个主要问题:1-列表非常大,大约有5000项。因此在浏览器中绑定(bind)如此大量的数据会使它挂起或变慢。(性能问题)根据Telerik文档SetadatasourcetotheRadComboBox.UseeitherDataSourceIDortheDataSourcepropertytodothisandsettheDataTextFieldandDataValueFieldpropertiestotherespectivefieldsinthedataso

c# - 错误绑定(bind) Gridview : "The current TransactionScope is already complete"

我正在对从Gridview发送的事件进行级联删除。删除在事务中。这是简化的代码:protectedvoidbtnDeleteUser_Click(objectsender,EventArgse){DataContextdb;db=newDataContext();using(TransactionScopets=newTransactionScope()){try{//deletesomedatadb.SubmitChanges();ts.Complete();}catch(Exceptionex){//handleerror}finally{db.Dispose();BindGrid