title: Sitecore change rendering datasource
body: <p>Hello I would like create special page for private use for where i will be have possibility to change data source value for each rendering item.
  I have created next code, but it dos't save any changes to items.</p>
  
  <pre><code>  SC.Data.Database master = SC.Configuration.Factory.GetDatabase("master");
              SC.Data.Items.Item itm = master.GetItem(tbPath.Text);
              if (itm != null)
              {
                  // Get the sublayout to update
                  //string sublayout_name = txtSublayout.Text.Trim();
                  //if (!string.IsNullOrEmpty(sublayout_name))
                  {
                      // Get the renderings on the item
                      RenderingReference[] refs = itm.Visualization.GetRenderings(SC.Context.Device, true);
                      if (refs.Any())
                      {
                          //var data = refs.Select(d=&gt;d);
                          //refs[0].Settings.DataSource
                          var sb = new StringBuilder();
                          using (new SC.SecurityModel.SecurityDisabler())
                          {
                              itm.Editing.BeginEdit();
                              foreach (var d in refs)
                              {
                                  if (d.Settings.DataSource.Contains("/sitecore/content/Site Configuration/"))
                                  {
                                      var newds = d.Settings.DataSource.Replace("/sitecore/content/Site Configuration/", "/sitecore/content/Site Configuration/" + tbLanguage.Text + "/");                                   
                                     // sb.AppendLine(string.Format("{0} old: {1} new: {2}&lt;br/&gt;", d.Placeholder, d.Settings.DataSource, newds));
                                      d.Settings.DataSource = newds;
                                  }
                              }
                              itm.Editing.EndEdit();
                          }                        
                          //lblResult.Text = sb.ToString();
  
                  }
              }
          }
  </code></pre>
  
  <p>how I can change data source ?
  thanks </p>