Groups | Blog | Home
all groups > dotnet windows forms databinding > may 2006 >

dotnet windows forms databinding : Binding Lost?


Özden Irmak
5/24/2006 9:40:07 PM
Hello,

I wrote a custom control which has a textbox inside it and it has a value
property which is bindable to a datasource.

In my sample screen, I have a datagrid and a bunch of my custom control. I
bind them to the same datasource so when the user moves in the rows of the
grid, my custom control values do change, it's fine.

In this screen, I also have a section where I let the user to filter
records. To filter the records, I set a dataview to my grid based upon the
user entry as filter criteria.

The problem starts here, when I set the dataview to the grid, all of my
custom controls loose their binding. No matter I navigate on the rows, none
of the values in my control gets updated?

Why does this occur, can anybody help?

Regards,

Özden

Chris Jobson
5/25/2006 9:15:41 PM
[quoted text, click to view]

It sounds like you are changing the DataSource property of the grid. If so
then this explains the problem - the controls will only update in response
to navigation on the grid if they are bound to the SAME datasource as the
grid (i.e. the values of the DataSource properties of the grid and the
controls must be identical). The solution is either to rebind the controls
to the dataview when you bind the grid to it, or to bind everything to a
dataview initially then just change the dataview's filter property in
response to the user input.

Chris Jobson

AddThis Social Bookmark Button