how to set selected elements in DevExpress' CheckedComboBoxEdit - devexpress

I'm a newbie for DevExpress controls. I have a DevExpress checkedComboBoxEdit control that is populated by data from SQL Server using Linq. Populating the checkedComboBox elements worked fine but I couldn't figure out how to set the selected elements.
The DB table contains three fields
id (Value Member),
Role (Display Member)
Applies (contains 0 for unselected and 1 for selected)
I want to select the checkbox elements based on the Applies field. How can I do this? Or is there a better way of doing this by modifying the database table? Or is there a CheckedComboBox property to do this?
Thanks

You should find all you need in the DevExpress online doumentation. In particular:
To initialize the check items' values and display text with values of
these fields, assign the names of the fields to the
RepositoryItemCheckedComboBoxEdit.ValueMember and
RepositoryItemCheckedComboBoxEdit.DisplayMember properties.
So in your case, you should assign 'Role' to the DisplayMember property and 'Applies' to the ValueMember property (rather than 'id').

To Unchecked all items in CheckedComboBoxEdit
For i = 0 To CheckedComboBoxEdit1.Properties.Items.Count - 1
clUSER_ID.CheckedComboBoxEdit1.Items.Item(i).CheckState =
CheckState.Unchecked
Next

Related

Filter and Bind a Multiselect

I am trying to implement a Many-to-Many relation between a class and its students in a form.
The form can be used to create or edit a class. Also students can be added to that class. To reduce the effort needed to enter students, I would like to add a multi-select that shows the entries from the students-table. But since the number of students is expected to be large, I would like to filter this multi-select.
I checked this question on filtering lists and the sample app "Project List. I understand that the standard workflow with a table would be to bind the value of a search box to the #datasources.STUDENTS.query.filters.email._contains and set the tables datasource property to STUDENTS
But, as I understand it, a multi-select element's value property must be bound to #datasource.item.students and its datasource property must be CLASS in order for the auto-saving to work.
Hence I wonder whether it is possible to filter a multi-select element.
I don't see the problem, but I think I see a misunderstanding.
You said: "I understand that the standard workflow with a table would be to bind the value of a search box to the #datasources.STUDENTS.query.filters.email._contains"
You need to bind the OPTIONS (not value) to the datasource query, as it is the options that will draw its records from the #datasources.Students.query datasource.
You can then set the VALUE of the multi-select widget to #datasource.item.students (where you want selected values from the student query options to be saved).
You will also need to set the NAMES property (since the options are likely student records). Names will be the Student datasource projection of whatever string field you want to appear in the options list.

Access Bound Combobox with lookup Field?

I have a table. Table1. Table1.[Field1] displays a lookup field taken from Table2.[Field2].
In my Form I have two comboboxes. Combobox1 is bound to Table1.[Field2].
Remember.... Table1.[Field1] is displaying the "looked up value".
What I want to do is to use a bound Combobox2 so that it displays the looked up value (I have achieved this)... and then, when I change that value using the drop down list in Combobox2 to another value, it changes the record displayed in all my other controls, including Combobox1.
I'm not too sure what settings to use in my properties. Would anyone know how to achieve the above?
Thanks
(MS Access 2010)(Windows 7 Pro)

ASP.NET Datasource bound to Combo. Include all entries

I have 2 combo boxes bound to a data-source, in order to make a search web page in ASP.NET. Both combo boxes are bound to database tables. The data-source determines its SQL SELECT statement based on the values of the combo boxes, so results are filtered. But, I want to include the case where the user doesn't want to set a value in some of the combos and wants to retrieve all database records regarding this combobox. I have included static entries in both combos (e.g. ), but how can I program the datasource, so as when is selected by user, no WHERE statement will be applied?
I found this answer a bit useful, but there are security issues and is not so straightforward.
Changing SqlDataSource.SelectCommand at runtime breaks pagination
Thanks in advance
Assuming that the value in the comboboxes when the user selects nothing is -1 you can modify your sql like this:
SELECT *
FROM TABLE
WHERE ((COLUMN_1 = #PARAM_1) OR #PARAM_1 = -1)
AND ((COLUMN_2 = #PARAM_2) OR #PARAM_2 = -1)
if you pass -1 as value for both parameters the query will return all the records in the table

Grid form layout using jsf (Jdeveloper & ADF)

I am trying to build a 6x6 grid layout. In each cell, there will be an input check box. I want to bind the checkboxes to my backing bean in a "consecutive fashion"...meaning, I would like to be able to iterate over the checkboxes to see whether they are checked or not. Basically, there must be an underlying data model. For example, you can drag over and drop off as a table, any item in the data control palette. Then in my application module, I can modify the view object as I wish before I save to the database. Now if I have a table with 36 rows and two columns (one is Id, one is Numeric (1 or 0)). I would like to drag over that table and drop off as a Grid that will enable a user to update each of the rows by selecting or 'un-selecting' a checkbox.
Try to use for each or Iterator component. They iterate over some array/collection and repeat elements enclosed within those components. You can check how Oracle does Dynamic Table (when you drag view object instance from application module to a page, choose dynamic table option) to get and idea.
try :
http://jobinesh.blogspot.com/2010/06/model-driven-approach-for-building.html
http://blogs.oracle.com/shay/2010/10/adf_faces_dynamic_tags_-_for_a.html
also try google with "dynamic form adf"

flex datagrid: how to do a multiple selection programmatically

I have I datagrid, on which I want to select multiple rows on a other user interaction than the one intended by the Programm. I'm wondering, whether I can programmatically select some rows depending only on code?
Thanks,
Markus
You can set the selectedIndices property to an array of indexes, or the selectedItems property to an array of items.
For example:
myDataGrid.selectedIndices = [1,2,5,8];

Resources