binding

Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY093]: Invalid parameter number:

╄→гoц情女王★ 提交于 2019-12-13 04:45:30
问题 I am attempting to use the following code to search a database using words in a search field. For some reason I am getting the following error Warning: PDOStatement::bindValue() [pdostatement.bindvalue]: SQLSTATE[HY093]: Invalid parameter number: Columns/Parameters are 1-based in.. Here is the function code: // Retrieve search results function retrieve_search_posts($searchfield){ //test the connection try{ //connect to the database $dbh = new PDO("mysql:host=localhost;dbname=mjbox","root",

How do you bind a ListBox's SelectedItem to another ListBox's SelectedItem's property?

扶醉桌前 提交于 2019-12-13 04:38:24
问题 I have a ListBox in my UI that is bound to List<Notification> Notifications { get; set; } : <ListBox ItemsSource="{Binding Notifications}" DisplayMemberPath="ServiceAddress" Name="NotificationsList"/> A Notification has a filter title associated with it: public class Notification { public string FilterTitle { get; set; } public string ServiceAddress { get; set; } } My UI has another ListBox that is bound to List<LogFilter> Filters { get; set; } : <ListBox ItemsSource="{Binding Filters}"

Enable TextBox depending on enum value

只谈情不闲聊 提交于 2019-12-13 04:36:44
问题 I have a TextBox that I want to enable if a Order 's Status is either OrderStatus.New or OrderStatus.Ordered . It it's something else, the TextBox should stay disabled. <TextBox Text="{Binding OrderedAmount}" IsEnabled="True"/> I assume I need to use some kind of MultiBinding, but cannot seem to find a proper resource on how to do that in this particular case. 回答1: You should use a ValueConverter for this: public class IsNewOrOrderedConverter : IValueConverter { public object Convert(object

BindingList ListChanged event not firing until filled with data?

烂漫一生 提交于 2019-12-13 04:23:50
问题 I'm writing code to eventually pull data from a remote database into a DataGridView using a databinding. I am currently creating the code to work with a CSV file and a BindingList as a test. I want a display on my form that shows the last time the database was updated. I'm currently using the ListChanged event on my BindingList to update the "last database update" display. The ListChanged event seems to only be firing if it's hooked up after the database is initially populated. Here's some

Binding the Visibility property of a WPF Datagrid column? Where is my fault?

萝らか妹 提交于 2019-12-13 03:49:05
问题 In a loop which sets up my WPF DataGrid columns, I want to bind the column visibility to member 'i' in my 'VisibilityList' with the following code: var bindingColumnVisibilty = new Binding(string.Format("VisibilityList[{0}]", i)); BindingOperations.SetBinding(customBoundColumn, DataGridColumn.VisibilityProperty, bindingColumnVisibilty); I have set the DataContext before the loop begins: TestControlDataGrid.TestDataGrid.DataContext = dataGridSource; The dataGridSource class contains: public

Binding data to a DataGridView

 ̄綄美尐妖づ 提交于 2019-12-13 03:39:30
问题 I have a bit of code which loads data from a stored procedure in MS SQL Server and then loads the data into a DataGridView , which works fine. What I want is for the code that connects / loads the data to sit in my Database class and then everything associated with the DataGridView to be stored in my Form but I am having problems passing the contents of the BindingSource over to the Form from the Database class. Form1 code: Public Class Form1 Dim myDatabaseObj As New Class1() Dim

Bind dynamically added form to submit event with jQuery

大兔子大兔子 提交于 2019-12-13 03:38:49
问题 What would be the best way to handle the submit event when you have multiple forms dynamically created with the same form id in jQuery? So far this line makes that jQuery only handles the first form. $("form#noteform").submit(function(){ // do stuff }); Kind of confusing, because I really need to catch the submit of a particular form to get the correct post values, therefore the selector of the form must be unique. How can you make it listen to all submits and later identify if it is the

ItemsSource and collections in which only element properties change

女生的网名这么多〃 提交于 2019-12-13 03:36:45
问题 I'm having grief with a ComboBox not reflecting changes in the properties of the collection to which its ItemsSource is bound. There is a tree made up of a Categories observable collection of Category objects containing Setting objects. Some settings define the presentation names for the domain of values permitted for other settings. These are spread over several categories, but a little magic with LINQ produces an ObservableCollection in which ChannelCategory exposes properties ChannelNumber

wpf datagrid combobox binding staticresource list of keyvalue pairs

梦想的初衷 提交于 2019-12-13 03:36:20
问题 I hope someone can help me or post a link to related question, that would have the answer. I have read most of them and thats how I got this far... So I have a datagrid with 3 columns, two of them are binded to one datatable and the third one that is a comboboxcolumn should be binded to the other one. I binded the combobox column to a static resource. What I don't uderstand how to transform a datatable to a list of keyvalue pairs that I want to use as a static resource for my comboboxcolumn.

jQuery - why can't I bind events to elements in a loop?

断了今生、忘了曾经 提交于 2019-12-13 03:36:16
问题 Here is my code: var b = $(slipStream.conf.mainVis).find('p#prev'); b.click(function() { slipStream.slideLeft(); return false; }); b = $(slipStream.conf.mainVis).find('p#next'); b.click(function() { slipStream.slideRight(); return false; }); b = $(slipStream.conf.controls).find('li img'); console.log(b); for (var l in b) { l.click(function() { var visIndex = l.index(); console.log(visIndex); }); }; The first two bindings go through, no problem. But I can't loop through a collection and bind