Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
173
refresh the data in a wintree without disturbing it
posted

I have a wintree, outlook style, with a container containing a uttreeview with 2 levels  Parent/Child.

I need to refresh the data in the tree without disturbing the current layout of the nodes (leave what is expanded expanded and what is collapsed collapsed) Like outlook does when you get mail. You don't notice anything in the navigation tree.

The data is updated by a system timer on a given interval.

 

 

Here is how I populate the data:

public void LoadTreeView()
{
  dataSet.Tables.Add(dataHelper.GetDealer());
  dataSet.Tables.Add(dataHelper.GetCars());
  dataSet.Relations.Add
      (

"fkDealerCars", dataSet.Tables["Dealers"].Columns["DealerID"],
        dataSet.Tables[
"Cars"].Columns["DeaterID"], false);
  utTree.SetDataBinding(dataSet,
"Dealers");
  ...
  ...
}

public DataTable GetDealers()
{
  using (SqlConnection conn = new SqlConnection(ConnectionStr))
  {
    conn.Open();

    string sSQL = "proc_Dealers";
    SqlDataAdapter sqlDataAdapter = new SqlDataAdapter();
    using (SqlCommand cmd = new SqlCommand(sSQL, conn))
    {
      sqlDataAdapter.SelectCommand = cmd;
      sqlDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;
      sqlDataAdapter.SelectCommand.CommandTimeout = 300;
      DataTable dt = new DataTable("Dealers");
      sqlDataAdapter.Fill(dt);
      return dt;
    }
  }
}

What is the best way to make this happen?

Gina_M

Parents Reply Children
No Data