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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s