Update Several Asp.Net Controls together

Say we have two or more controls, on more than one forms. We want to update those controls, if there is a selection or change occurs at any one of them. How will we do this ?

keep them pointing to same DataSource like as follows.

public void UpdateControls()
  {
    List<string> filesDataSource = GetFiles(); // replace with your Datasource

    Control1.DataSource = filesDataSource ;
    Control2.DataSource = filesDataSource ;
    Control3.DataSource = filesDataSource ;

    Control1.DataBind();
    Control2.DataBind();
    Control3.DataBind();
  }

  Control1_SelectedIndexChanged(.............) // Replace with your evnents
  {
   // 
   //
   UpdateControls();
  }
Advertisements