Checkable ListView or Pageable CheboxList ASP .NET - c#

I need list view, that supports column with check boxes. Please help me add column with check boxes to ListView or add paging to CheckboxList
EDIT: I've forgot that also I need data bounding.
I've found out IPagedItemContainer interface and DataPager class. I need to add interface implementation to CheckboxList.
For Listview I haven't found any ideas on adding column

Use GridView with unvisible Header Row. And add a Checkbox Column.

Related

Adding a checkbox to a databound DataGridView

I'm working with DataGridView in C#. I fill it with a table from database using BindingSource. After filling the DataGridView I need to add a row of checkboxes that should be first in the table, to enable data filtering in future.
I mean: for example after clicking "Load" button I get DataGridView filled with 4 columns of data and the first row should consists of checkboxes.
I confused. I use
DataGridViewCheckBoxCell checkCell = new DataGridViewCheckBoxCell();
SourceDGV.Rows.Add(checkCell);
I mean here:
But after clicking load button it says You can't add rows to databounded DataGridView
Sorry if ecxeption translated wrong, I translated it from Ukrainian.
Any help appreciated.
Am afraid, there is no concept of whole rows to be of some type(checkbox in your case) in DataGridView. It is other way around. You can have whole column to be of checkbox type. You'd use DataGridViewCheckBoxColumn for that.
Showing checkboxes in whole row even makes no sense for me: Assume you have data bounded Person object to the DataGridView. So there will be columns like Name, Age, Address. Now, on what basis you show checkbox in the row? How can a Name be converted to a bool(which is what checkbox needs as a value)?
One workaround I can think of would be, handle custom painting, If First row paint checkboxes over there and manually handle their click events. But am pretty sure it's not gonna be easy.

How to add new line of row in devexpress gridcontrol?(WinForms C#)

I want to add a new line of row when pressing a button. In datagridview it would be:
datagridview1.Rows.Add()
What is the equivalent code for that in gridcontrol? Please help me.
You cannot add a new row directly to your GridControl, since this is just a container for the views. However, if you're using a GridView inside your GridControl (or any other descendant of ColumnView), you can add a new row using AddNewRow() method.
(myGridcontrol.MainView as DevExpress.XtraGrid.Views.Grid.GridView).AddNewRow();
Link to documentation
EDIT: You can access your view in a different way, of course.
The DevExpress GridControl must always be bound to a datasource: you cannot add rows directly to the GridControl object or its child GridViews.
Instead, you must bind your GridControl to a data source (via the GridControl.DataSource property), and add/remove rows via this data source.
See the 'Binding To Data' documentation at the DevExpress site for more information on the kinds of data sources that can be used with a GridControl.
You can use AddNewRow to add new row and SetRowCellValue to insert value to that row.
yourgridViewName.AddNewRow();
yourgridViewName.SetRowCellValue(rowhandle,columnName,value);
gridViewMappedFileds.UpdateCurrentRow();
Put yourgridName.RowCount-1 for rowhandle to insert the row at last.Put gridViewMappedFileds.Columns["ColumnName"] to give your columnname.

Change Filtering Type of Telerik GridViewComboBoxColumn

I have a telerik GridView contains ComboBox column, the filtering type is 'StartWith'. and I want to change it to 'Contains'.
How could i do it?
Check here Telerik Grid Filtering guide

Datagridview column sorting when clicking on the column header

I have a datagridview with two columns name and price.
If I click on the column header, the corresponding column will be sorted in alphabetical order. Do I need to add any event handler for sorting the datagrid view column? Or is there any property to set for sorting datagrid view column? I am working on a Windows application using C#.
Would anyone please help on this?
If you could use javascrip/jQuery I would suggest you to use the JQuery plugin Datatabe.
With that you can get the colum sorting, colum reordering, filtering and search all together.
EDIT:
If not javascript, then you can use the following guide: DataGrid sort

Problem in datagridviewComboBoxColumn

In my datagridview , when in click on datagridviewComboBoxColumn to populate its dropdownlist it not show me dropdown list for that i need to click 2 times. at first time it just focus to datagridviewComboBoxColumn and on second click it populate its dropdown. but i want to populate its dropdownlist on single click. please help me out. i am using c#.net (vs 2005)
The usual solution for this behaviour of the DataGridView is to set the EditMode property of the DataGridView to EditOnEnter.
There are some issues around using this approach, in particular that the row header is no longer available for row select. See Microsoft Connect here for more info on that issue.

Categories