473,385 Members | 1,356 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.

How to refresh a DataGrid?

Hi,

This might be the easiest question ever but I can't seem to find how to do
it: I have a DataGrid that's linked to an instance of IList (actually, it's
an ArrayList). On load, there's already data in the collection so when I
call the DataGrid's 'SetDataBinding' method, the DataGrid displays the data
correctly.

Problem is that when I add data to the collection afterwards, I can't
display it in the DataGrid. I tried calling its 'Refresh' method, its
'Update' method and even the 'SetDataBinding' method again without success.

Basically, in this case, how can I refresh the data in a DataGrid once the
source has changed?

Thanks,

SC
Nov 16 '05 #1
1 1847
SC,

You could set the DataSource of the grid to null, and then back to the
list. This is the hacky way.

If you wanted the grid to update when changes are made, then implement
the IBindingList interface, which has an event that you fire when changes
are made to your list.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Skip" <Sk**@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.com...
Hi,

This might be the easiest question ever but I can't seem to find how to do
it: I have a DataGrid that's linked to an instance of IList (actually,
it's
an ArrayList). On load, there's already data in the collection so when I
call the DataGrid's 'SetDataBinding' method, the DataGrid displays the
data
correctly.

Problem is that when I add data to the collection afterwards, I can't
display it in the DataGrid. I tried calling its 'Refresh' method, its
'Update' method and even the 'SetDataBinding' method again without
success.

Basically, in this case, how can I refresh the data in a DataGrid once the
source has changed?

Thanks,

SC

Nov 16 '05 #2

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

Similar topics

1
by: msnews | last post by:
Hi -- I'm very, very new to ASP.Net, and I've been trying for several days to figure out how to update a datagrid AND refresh it on the client side so that the page doesn't refresh. I've torn my...
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...
0
by: lucas | last post by:
Hi, I have a simple input form that i use to add records to a sql server database. Bellow that is a datagrid that has one template column that I use to dispaly the 3 fields with some html...
0
by: Marcus | last post by:
Hello! I'm buildning a webpage in ASP.NET using Visual Basic. The page contains a datagrid, a dropdownlist, some textboxes and a couple of buttons. The datagrid displays barcodes from a table...
1
by: Andre | last post by:
hi, In my Datagrid i have some text and a image (for each item), if i edit the image and save it to the HD there's no problem, but the image is always saved with the same name (item number.jpg)...
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: Erik | last post by:
I have a Form that has 2 OleDbAdapters and one dataset object. In the dataset I have two tables that are joined. My datagrid is looking at one table. I add new records to the datagrid. I want to...
2
by: Dan | last post by:
Hi, I have a Datagrid in a simple form that I programmatically modify using something like that : Me.DataGrid1(RowID, ColID) = "blablabla" But my cell wont refresh unless I click on another...
3
by: David Cartwright | last post by:
Hi all, I'm having a weird time with a call to the Refresh() method of a DataGridView. I have a VB.NET 2005 Windows application with a main form and a "worker" thread. The main form delegates a...
6
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi - I'm having trouble refreshing a datagrid control bound to a dataset that was created from the New Data Source wizard. What is the code required to refresh the datagrid with data from the...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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...

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.