views:

295

answers:

1

Hey guys,

I am using Telerik RadGridView control in my C# WinForms app.

I have user details showing up in the grid. I am trying to refresh data in my grid every x seconds. But no luck so far :(

Your help would prove a great favor to me :)

Here is what I have in my code-behind:

public Dashboard() {
    InitializeComponent();

    this.usersTableAdapter.ClearBeforeFill = true;
    this.usersTableAdapter.Fill(this.userList.Users);
}

private void Dashboard_Load(object sender, EventArgs e) {
    ReloadUserList();
}

private void ReloadUserList() {
    this.userList.Users.GetChanges();
    UsersGrid.GridElement.Update(Telerik.WinControls.UI.GridUINotifyAction.BatchDataChanged);
}

private void UserListTime_Tick(object sender, EventArgs e) {
    ReloadUserList();
}

Thank you :)

A: 

Hello,

If you are creating a new UsersList when you get the changes you should just set the new UsersLists as the data source for the grid.

If it is the same instance and you are not using INotifyPropertyChanged you can just call a Refresh() on the Grid.

Best Regards, Emanuel Varga

Emanuel Varga