473,385 Members | 1,317 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Refresh of loaded data DataTable inside.



Hi;
I'm building a control that has a DataTable's property type. The control contains treeview which
is populated in foreach crossing rows of the DataTable established in the property.

I require a mechanism so that when they change the loaded data of the DataTable these are
reflected in treeview.

Somebody can offer information to me...

Thanks...

Alvaro.
Nov 17 '05 #1
2 2874
I'm not sure I understand the question entirely. You mean you're binding a
DataTable to the control? Is it cast as a DataTable?

A better (and more generic and .NET) method would be to provide a DataSource
(object) and DataMember (string) similar to the way the grid does.

Then you would get a CurrencyManager from the BindingContext like so:

CurrencyManager cm = BindingContext[dataSource, dataMember] as
CurrencyManager;

Subscribe to the CurrencyManager events (ItemChanged, CurrentChanged,
MetaDataChanged, PositionChanged) to get updates about changes to the
underlying data and use the CurrencyManager to actually retrieve the data.

This gives you the advantage of being able to bind any IList or IListSource
implementor to your control. This includes DataSets, DataTables, DataViews,
DataViewManagers, arrays, and so forth. Since the CurrencyManager handles
all the data transport, you don't actually have to care what kind of data
you're bound to.

There are two articles on my web site about the CurrencyManager that you
might find helpful:

http://www.petedavis.net/MySite/DynP...aspx?pageid=19

and

http://www.petedavis.net/MySite/DynP...aspx?pageid=22

In addition, this page has some good information:

http://noiseehc.freeweb.hu/CurrencyManager.html

Pete
"Alvaro E. Gonzalez V." <ag********@gmail.com> wrote in message
news:uX**************@TK2MSFTNGP11.phx.gbl...


Hi;
I'm building a control that has a DataTable's property type. The control
contains treeview which is populated in foreach crossing rows of the
DataTable established in the property.

I require a mechanism so that when they change the loaded data of the
DataTable these are reflected in treeview.

Somebody can offer information to me...

Thanks...

Alvaro.

Nov 17 '05 #2
Thanks...
Pete Davis wrote:
I'm not sure I understand the question entirely. You mean you're binding a
DataTable to the control? Is it cast as a DataTable?

A better (and more generic and .NET) method would be to provide a DataSource
(object) and DataMember (string) similar to the way the grid does.

Then you would get a CurrencyManager from the BindingContext like so:

CurrencyManager cm = BindingContext[dataSource, dataMember] as
CurrencyManager;

Subscribe to the CurrencyManager events (ItemChanged, CurrentChanged,
MetaDataChanged, PositionChanged) to get updates about changes to the
underlying data and use the CurrencyManager to actually retrieve the data.

This gives you the advantage of being able to bind any IList or IListSource
implementor to your control. This includes DataSets, DataTables, DataViews,
DataViewManagers, arrays, and so forth. Since the CurrencyManager handles
all the data transport, you don't actually have to care what kind of data
you're bound to.

There are two articles on my web site about the CurrencyManager that you
might find helpful:

http://www.petedavis.net/MySite/DynP...aspx?pageid=19

and

http://www.petedavis.net/MySite/DynP...aspx?pageid=22

In addition, this page has some good information:

http://noiseehc.freeweb.hu/CurrencyManager.html

Pete
"Alvaro E. Gonzalez V." <ag********@gmail.com> wrote in message
news:uX**************@TK2MSFTNGP11.phx.gbl...

Hi;
I'm building a control that has a DataTable's property type. The control
contains treeview which is populated in foreach crossing rows of the
DataTable established in the property.

I require a mechanism so that when they change the loaded data of the
DataTable these are reflected in treeview.

Somebody can offer information to me...

Thanks...

Alvaro.


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Mark | last post by:
I have a working PHP/MySQL application used for data entry. The data entry screen includes a "Save" button. The PHP code for this button looks like this: if (isset($_POST)) { if ($_POST ==...
10
by: Conax | last post by:
Hi there, My boss is hoping that I can come up with a page that displays some information. The information will always be displayed on specific part of the page, with auto refresh. But he...
4
by: Cat | last post by:
If you have a datagrid with an underlying dataset and rows are added to the dataset during a program run, how do you get the datagrid to update itself to repflect the changes in the underlying...
5
by: Scott Lyon | last post by:
I am having a strange problem. The program is a bit complex, but I'll try to simplify what I can. I apologize if this is complicated, but I think this would still be simpler than posting a bunch of...
0
by: Brad White | last post by:
Overview: I have a custom web app that has an 'Inbox' that refreshes every 30 seconds. One user uses Outlook to host the web page. Using IE, the refresh works fine. If the user is working in...
7
by: Juan Romero | last post by:
Hey guys, please HELP I am going nuts with the datagrid control. I cannot get the damn control to refresh. I am using soap to get information from a web service. I have an XML writer output...
0
by: thomasp | last post by:
This is a two part question, 1) The code below should display a form with a datagridview and a few command buttons. This form should allow the user to make change to the records displayed in...
2
by: Matthias | last post by:
Hi Team this may be a newbie question. I have searched the discussions before posting: I'd like to re-use a form instance to edit record details. My data binding (a DataTable bound to...
6
by: George | last post by:
Hi, I have been encountering a refresh problem with DataGridView, which is bound to a DataTable. When I make updates (Add, Delete, update) to the DataGridView, everything flow nicely to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.