PC Review


Reply
Thread Tools Rate Thread

Databinding the second

 
 
Markward
Guest
Posts: n/a
 
      10th Jun 2005
Hi again,

I am back with my old question in a changed scenario.

As described before, I have som touble with updating a listView, that
has a bound table.

I'll try to describe the scen.:

For those who read my fist post: I changed from ArrayList to
DataSet+DataTable.

Form1 has a Listview and a button to open Form2
A DataTable is bound to the Form1-Listview.
Form2 has some Textboxes bound to the currently selected Element in the
Listview of Form1.
The Textboxes of Form2 are populated well with the DataTable bound to
the Listview. Changes made to the data in the textboxes are
communicated to the underlying DataTable, as I call
this.BindingContext[Global.patientenTable].EndCurrentEdit(); on
clicking on an ok button in Form2.

When closing Form2, bringing Form1 back to display, the changes have
not been reflected by the Listview, which still shows the old value of
the property recently changed.

I added a button to do some "brutal" refresh by setting the Listviews
DataSource to null an back to my Table again. Clicking this button
shows the correct new value of my property.

I am pretty desperate now, because I expected the ADO-Klasses to
implement the RefreshOnChange-kind-of functionality just by them
selves.

If I went wrong in that point, could someone plz tell me the preferred
pattern to cause refreshes to all Controls bound to a DataSource ? I
can'T believe, that I have to do many "null-settings" like described
above.


Here some codeexcerpts that may be of interest:


// Binding Data to Listview in Form1
this.listboxPatienten.DisplayMember = "name";
this.listboxPatienten.ValueMember = "uniqueId";
this.listboxPatienten.DataSource = Global.patientenTable;
this.listboxPatienten.SelectedIndex = -1;

// Binding the Textboxes in Form2
textboxName.DataBindings.Add("Text",Global.patientenListDlg.listboxPatienten.DataSource,"name");
textboxForename.DataBindings.Add("Text",Global.patientenListDlg.listboxPatienten.DataSource,"forename");
textboxStreet.DataBindings.Add("Text",Global.patientenListDlg.listboxPatienten.DataSource,"street");
textboxPlz.DataBindings.Add("Text",Global.patientenListDlg.listboxPatienten.DataSource,"plz");
textboxCity.DataBindings.Add("Text",Global.patientenListDlg.listboxPatienten.DataSource,"city");
textboxUniqueId.DataBindings.Add("Text",Global.patientenListDlg.listboxPatienten.DataSource,"uniqueId");

// Ending the edit-process in Form2
this.BindingContext[Global.patientenTable].EndCurrentEdit();

// My 'brutal' refresh

this.listboxPatienten.DataSource = null;
this.listboxPatienten.DisplayMember = "name";
this.listboxPatienten.ValueMember = "uniqueId";
this.listboxPatienten.DataSource = Global.patientenTable;


Hopefully someone can help.

 
Reply With Quote
 
 
 
 
Ilya Tumanov [MS]
Guest
Posts: n/a
 
      10th Jun 2005
I'm confused... I don't believe CF's Listview control supports data binding.

Also, I believe binding context is not shared across forms unless one form
is a parent of another.


Best regards,



Ilya



This posting is provided "AS IS" with no warranties, and confers no rights.



*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/...ramework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

"Markward" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi again,
>
> I am back with my old question in a changed scenario.
>
> As described before, I have som touble with updating a listView, that
> has a bound table.
>
> I'll try to describe the scen.:
>
> For those who read my fist post: I changed from ArrayList to
> DataSet+DataTable.
>
> Form1 has a Listview and a button to open Form2
> A DataTable is bound to the Form1-Listview.
> Form2 has some Textboxes bound to the currently selected Element in the
> Listview of Form1.
> The Textboxes of Form2 are populated well with the DataTable bound to
> the Listview. Changes made to the data in the textboxes are
> communicated to the underlying DataTable, as I call
> this.BindingContext[Global.patientenTable].EndCurrentEdit(); on
> clicking on an ok button in Form2.
>
> When closing Form2, bringing Form1 back to display, the changes have
> not been reflected by the Listview, which still shows the old value of
> the property recently changed.
>
> I added a button to do some "brutal" refresh by setting the Listviews
> DataSource to null an back to my Table again. Clicking this button
> shows the correct new value of my property.
>
> I am pretty desperate now, because I expected the ADO-Klasses to
> implement the RefreshOnChange-kind-of functionality just by them
> selves.
>
> If I went wrong in that point, could someone plz tell me the preferred
> pattern to cause refreshes to all Controls bound to a DataSource ? I
> can'T believe, that I have to do many "null-settings" like described
> above.
>
>
> Here some codeexcerpts that may be of interest:
>
>
> // Binding Data to Listview in Form1
> this.listboxPatienten.DisplayMember = "name";
> this.listboxPatienten.ValueMember = "uniqueId";
> this.listboxPatienten.DataSource = Global.patientenTable;
> this.listboxPatienten.SelectedIndex = -1;
>
> // Binding the Textboxes in Form2
> textboxName.DataBindings.Add("Text",Global.patientenListDlg.listboxPatienten.DataSource,"name");
> textboxForename.DataBindings.Add("Text",Global.patientenListDlg.listboxPatienten.DataSource,"forename");
> textboxStreet.DataBindings.Add("Text",Global.patientenListDlg.listboxPatienten.DataSource,"street");
> textboxPlz.DataBindings.Add("Text",Global.patientenListDlg.listboxPatienten.DataSource,"plz");
> textboxCity.DataBindings.Add("Text",Global.patientenListDlg.listboxPatienten.DataSource,"city");
> textboxUniqueId.DataBindings.Add("Text",Global.patientenListDlg.listboxPatienten.DataSource,"uniqueId");
>
> // Ending the edit-process in Form2
> this.BindingContext[Global.patientenTable].EndCurrentEdit();
>
> // My 'brutal' refresh
>
> this.listboxPatienten.DataSource = null;
> this.listboxPatienten.DisplayMember = "name";
> this.listboxPatienten.ValueMember = "uniqueId";
> this.listboxPatienten.DataSource = Global.patientenTable;
>
>
> Hopefully someone can help.
>



 
Reply With Quote
 
Markward
Guest
Posts: n/a
 
      11th Jun 2005
Ohh Sorry,

I mixed up the names. Of course I am binding to a ListBox-Component.

Sry

 
Reply With Quote
 
Ilya Tumanov [MS]
Guest
Posts: n/a
 
      14th Jun 2005
It's turned out to be a known issue fixed in NETCF V2.



In CF V1 all list controls (except for DataGrid) would ignore list changed
events from DataSource.

There's no good workaround, sorry. You might be able to extend ComboBox
class and override SetItemCore(int index, object value), but this is quite
messy.


Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/...ramework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

"Markward" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Ohh Sorry,
>
> I mixed up the names. Of course I am binding to a ListBox-Component.
>
> Sry
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Databinding expressions are only supported on objects that have a DataBinding event jobs Microsoft ASP .NET 0 26th Sep 2007 01:54 AM
Gridview encoding, or how to run commands before gridview's default databinding, or, how do I disable default databinding at all? Sergei Shelukhin Microsoft ASP .NET 1 12th Nov 2006 02:43 PM
Databinding Alan T Microsoft C# .NET 2 17th Jul 2006 06:08 PM
Databinding Bible (REPOST FROM m.p.d.f.WindowsForms.Databinding) a Microsoft ADO .NET 1 16th Jul 2004 04:26 AM
ADO.NET and ASP.NET DataBinding Lloyd Sheen Microsoft ADO .NET 0 29th Jun 2004 03:15 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:30 PM.