jjzjj

datasource

全部标签

c# - 使用 Kendo Grid,如何更改工具栏中 "Create"按钮上的文字?

我使用的是KendoGrid,我添加了“创建”以内联添加记录。如何更改添加按钮上的措辞?目前显示为:“添加新记录”我想将其简化为只读“添加”并且我还想保留相同的图标。我的代码如下:$reports.kendoGrid({dataSource:dataSource,toolbar:["create"],...如有任何建议,我们将不胜感激。 最佳答案 执行此操作的方法是使用以下语法:$reports.kendoGrid({dataSource:dataSource,toolbar:[{name:"create",text:"Add"}]

c# - 为具有 KeyValuePair 列表的 ComboBox 选择最初选择的值作为 DataSource

我正在从List创建一个组合框的KeyValuePair.到目前为止,它在向用户提供描述性名称同时返回数字ID方面效果很好。但是,无论我尝试什么,我都无法选择最初选择的值。publicStartUpForm(){InitializeComponent();FlowLayoutPanelflowLayout=newFlowLayoutPanel();//Thisisnecessarytoprotectthetable,whichisforsomereasoncollapsing...flowLayout.FlowDirection=FlowDirection.TopDown;flowLa

c# - AllowUserToAddRows 不适用于 DataGridView 上的 List<> 数据源

我有一个DataGridView与DataSource设置为List但是,当我设置AllowUserToAddRows时,新行指示器不显示至true,当我设置DataSource至BindingList,这似乎解决了问题。问:应该替换我的List与BindingList或者有更好的解决方案? 最佳答案 是否myClass有一个公共(public)的无参数构造函数?如果不是,您可以从BindingList派生并覆盖AddNewCore调用您的自定义构造函数。(edit)或者-只需将您的列表包装在BindingSource中它可能会起作

C# 更新组合框绑定(bind)到通用列表

我的表单上有一个组合框,它绑定(bind)到一个通用的字符串列表,如下所示:privateListmAllianceList=newList();privatevoidFillAllianceList(){//Addalliancenametomemberalliancelistforeach(Villageallianceinalliances){mAllianceList.Add(alliance.AllianceName);}//Bindalliancecomboboxtoalliancelistthis.cboAlliances.DataSource=mAllianceList

c# - DataGridView 使用对象列表过滤 BindingSource 作为 DataSource

我正在尝试使用BindingList作为数据源来过滤BindingSource。我尝试了BindingSource.Filter='TextCondition'但它没有用,没有任何反应,屏幕上的数据保持不变。但是,如果我使用DataSet作为数据源,它就可以工作。是否可以使用BindingSource.Filter属性过滤对象列表?我有以下类(class):classPerson{publicStringNombre{get;set;}publicStringApellido{get;set;}publicintDNI{get;set;}publicintEdad{get;set;}p

c# - 销毁对象时自定义事件是否需要设置为null?

假设我们有2个对象,Broadcaster和Listener。Broadcaster有一个名为Broadcast的事件,Listener订阅了该事件。如果Listener在没有取消订阅Broadcast事件的情况下被释放,它将保留在内存中,因为Broadcaster包含引用它的事件委托(delegate)。我很好奇的是,如果Broadcaster在没有Listener取消订阅或Broadcaster设置Broadcast=null的情况下被处置,Broadcaster是否会保留在内存中?除了一位博主认为不将事件设置为null会将源保留在内存中(找到here)之外,我无法找到任何对这个问

c# - ListBox 和 Datasource - 防止第一项被选中

嘿。我有以下代码填充我的列表框UsersListBox.DataSource=GrpList;但是,在框被填充后,列表中的第一项默认被选中,并且“selectedindexchanged”事件被触发。如何防止在填充列表框后立即选择项目,或者如何防止触发事件?谢谢 最佳答案 为了防止事件触发,这里有两个我过去使用过的选项:在设置数据源时取消注册事件处理程序。UsersListBox.SelectedIndexChanged-=UsersListBox_SelectedIndexChanged;UsersListBox.DataSour

c# - 为什么checkedlistbox没有数据源?如何绑定(bind)到值列表?

我正在开发一个Winform,我需要一个checkedlistbox。我将值存储在一个具有List属性的对象中:publicstaticclassFields{publicstaticIListFieldList{get;set;}staticFields(){...//populateFieldList}}现在我希望我的CheckedListBox使用Fields.FieldList作为数据源。在网上搜索后发现需要设置//inmyForm_LoadmycheckedListBox.DataSource=Fields.FieldList;但是myCheckedListBox没有Data

c# - 如何将 DataSource 转换为 List<T>?

我有以下在DataGridView上加载产品的方法privatevoidLoadProducts(Listproducts){Source.DataSource=products;//SourceisBindingSourceProductsDataGrid.DataSource=Source;}现在我正试图将它们还给我以保存它们,如下所示。privatevoidSaveAll(){Repositoryrepository=Repository.Instance;Listproducts=(List)Source.DataSource;Console.WriteLine("Estees

c# - 将DataSource设置为Datagridview后添加一行

我有很多与数据网格的数据源绑定(bind)相关的问题。我有一个DatagridView,我正在从列表中设置DataSourceListli=newList();MyClassO=newMyClass();O.Name="Aden";O.LastName="B";O.Id=12;li.Add(O);O=newMyClass();O.Name="Li";O.LastName="S";O.Id=22;li.Add(O);Mydgv.DataSource=li;MyClass在哪里publicClassMyClass{publicstringName{get;set;}publicstring