Re: Basic Binding and Filtering Problem

Tech-Archive recommends: Fix windows errors by optimizing your registry





"Bart Mermuys" wrote:

Hi,

"Dok" <Dok@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:641029F7-E251-4EFF-8D5C-424A09C7937F@xxxxxxxxxxxxxxxx

[snip]
Hey Bart - I don't have any code written beyond filling the data adapter.
That's all it takes to keep the controls and grid in sync when all of them
are bound to a dataset; the grid is filled immediately as soon as the form
is
loaded and clicking on individual records updates the controls properly.
I've
tried binding the controls and the grid to the same dataview instead and
filling the data adapter during the form's load event in the exact same
way,
but then it doesn't stay in sync. In both cases the grid immediately fills
up
with a few thousand items upon the window's creation, but the controls
only
update when navigating the records in the grid if they're all bound to the
same dataset, not the same dataview. It is possible to navigate the
records
in the same way with either a dataset or a dataview, but there's no
synchronization with the other controls with the latter. They're out of
sync
right from the beginning, as soon as the form loads and it stays that way
no
matter how many records you navigate through in the datagrid. An empty
list
is not a factor because the table the grid is bound to always has a few
thousand records in it.

I'm stumped because there's very little code involved and no change in any
other variables beyond changing the binding of the controls to the same
dataview instead of the same dataset,

I don't know what is going on either, from what you are describing it still
sounds like the same DataView isn't used, though i realize you clearly state
you are using the same DataView.

You know, when you bind to a DataSet it will (internally) use a DataView too
(DataSet nor DataTable are directly bindable). So maybe you can go this
way. Bind everything to a DataSet (since that's working) and then use the
following code to filter:

CurrencyManager cm = (CurrencyManager)BindingContext[yourDataSet,
"YourTableName"];
DataView dv = (DataView)cm.List;
dv.RowFilter = "...";

Other then that, also be carefull because DateTimePicker, CheckBox and other
Controls may have problems with null values or empty lists, so you might
just want to try with only a grid and TextBoxes until you know it's working.

HTH,
Greetings


Thanks Bart, I'll give that code a shot and see what happens. You know, it
very well might be a problem with null values like you said because many of
the initial records have null values for their date columns. I'll check that
out too. I can tell this is one of those frustrating programming problems
where the culprit is something that's gone unnoticed because it's
embarrassingly simple, LOL - I hate those most of all, hah hah. This little
problem has held me up more that some of the complicated code I was writing
for the same project. Thanks for your help :D

--- Steve
.



Relevant Pages

  • Re: Basic Binding and Filtering Problem
    ... If I access the data through a dataset, the grid and monthcalendar bind ... i woud use DataView for all ... Controls and then filter that. ... Hey Bart - I don't have any code written beyond filling the data adapter. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Basic Binding and Filtering Problem
    ... That's all it takes to keep the controls and grid in sync when all of them ... same dataset, not the same dataview. ...
    (microsoft.public.dotnet.framework.adonet)
  • ViewState Issues
    ... I have a form with sever data controls (No controls are embedded, ... The first control is a DataView, following that are 3 Grid Views. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Complex GirdView Problem, returning values from dynamic Templa
    ... From within that method you will have access to the grid row ... Issue #2 - Save the user's selectionto viewstate. ... the controls were not accessible. ... > However, from your example, instead of a GridView I created a PlaceHolder. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: FlexGrids on SSTabs
    ... Norm, I tried the invisible Frames suggestion, and it appears to work ... Left property of a grid causes it to move to a diferent tab, ... do some OTHER untried combination of controls / programming? ...
    (microsoft.public.vb.controls)