Re: How to refresh a DataGrid?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Nicholas Paldino [.NET/C# MVP] (mvp_at_spam.guard.caspershouse.com)
Date: 10/19/04


Date: Tue, 19 Oct 2004 10:52:33 -0400

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]
               - mvp@spam.guard.caspershouse.com
"Skip" <Skip@discussions.microsoft.com> wrote in message 
news:9FD9B92E-AD6F-459F-B905-010C0364B16C@microsoft.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 


Relevant Pages

  • How to refresh a DataGrid?
    ... I have a DataGrid that's linked to an instance of IList (actually, ... Problem is that when I add data to the collection afterwards, ... '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 ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Persistent Web Application
    ... you would need to add a global timer to your global asax file. ... > The top portion is an Order entry and the Bottom part is a Datagrid ... I want to be able to refresh my datagrid ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Persistent Web Application
    ... The top portion is an Order entry and the Bottom part is a Datagrid ... I want to be able to refresh my datagrid ... How would the HttpApplicationState object help in this context? ...
    (microsoft.public.dotnet.languages.csharp)
  • DataGridView.Refresh() hangs on cross-thread call
    ... The main form delegates a Sub to the worker so that the ... latter can refresh the DataGrid after updating the DataTable driving it. ... Dim d As New dgExtRefreshCallback(AddressOf dgExtRefresh) ... locking in to ensure that the DataTable behind the DataGrid ...
    (microsoft.public.dotnet.general)
  • Re: SQLCeResultSet does not update first row
    ... Perhaps a DataGrid expert like Ilya will jump in if there's something I'm ... Is there no finer-grained mechanism to tell th datagrid to refresh ONLY ... Ginny Caughey wrote: ... result set in the grid, but it's still the same principle. ...
    (microsoft.public.dotnet.framework.compactframework)