Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
i am using DataGridViewAutoFilter.dll to add a dropdown filter to my datagrid. i both have bound and unbound columns. The datatable i call from database is bound to a binding source and binding source is bound to dataGridView. one of my columns is editable, i want user to enter a number of quantity of product to be ordered. but, when i sort datagridview from a column, or when i filter datagridview, datagridview loses all of the column content.

also i can't handle filter event. i want to change color of the rows, when i filter, color is gone like contents.

what can i do for them? thanks from now for the answer..
Posted
Comments
Sagar Sumant 18-Jun-13 15:06pm    
can you please add code that you are using/working on?
ahmetkocadogan 18-Jun-13 16:08pm    
ok, here i start to tell about my code. i write a sql statement that makes a suggestion of order, it displays products that we sell, and how many should i buy to be able to have optimum quantity in my company. i get the datatable with sqldataadapter, and bind it to a bindingsource.

bindingSource1= GetOrderSuggestion();// this method returns datatable.
datagridview1.DataSource=bindingSource1;

with DataGridViewAutoFilter.dll, i make bound columns and display my datatable with autofiltercolumns. but, i have an unbound column, that user write quantity.
here is the link of autofilter topic : http://msdn.microsoft.com/en-us/library/aa480727.aspx#datagridviewautofiltercolumnheadercell_topic4

but when i sort, or filter from datagridviewcolumn,
the content of unbound column disappears.

and i color rows that has a suggestion to buy a product. it works with foreach statement

foreach(datagridviewrow dgvr in datagridview.rows)
{
//makes the colouring thing
}

but when i sort or filter, i loose both content and colors. i can handle dataGridView_Sorted event, and can make the coloring there, but cant do the same with autofilter.
and much more important, the content of quantity of order.

there is not much code about this, i read something about virtualmode, adding dictionary and store the value change and the index of that value. i tried them, but couldnt manage all day long. if you still want some code, i can copy paste, but this is the situation, and the problem is about datagridview at runtime.

i will be appreciated if you can find a solution. sorry if my english is bad. thanks from now..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900