What do you do, if Change Event does not work when you viewed in browser?

You have to use PostBack properties in your controls.

e.g.

You have some method for Change Event at DropDown control:

public void test_Changed(object sender, XmlEventArgs e)
  {
       XPathNavigator root = MainDataSource.CreateNavigator();
       XPathNavigator test1 = root.SelectSingleNode
      ("/my:myFields/my:test1",  NamespaceManager);
       test1.SetValue("test1");
   }

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

Properties

Hi all. I’m upload my presentation with MS SWIT 2010 Ukraine. You can see – http://cid-bb6ac8ca5eb9828e.office.live.com/browse.aspx/MS%20SWIT%202010?uc=1

Hi all. Today I should talk about automatic rename file name on document library in Sharepoint 2010. Sample, I have one document library and include more folders with documents inside. I can create event receiver for automatic update name file on folders in library.

I’m used class SPFile and method GetFile() for gets properties created file.

SPFile – Represents a file in a SharePoint Web site that can be a Web Part Page, an item in a document library, or a file in a folder.

This sample automatic update file name in folders document library Sharepoint 2010.

public class EventReceiver1 : SPItemEventReceiver
    {
       /// <summary>
       /// An item was added.
       /// </summary>
       public override void ItemAdded(SPItemEventProperties properties)
       {
           base.ItemAdded(properties);

           SPFile file = properties.Web.GetFile(properties.ListItem.Url);
           if (file.Item.ContentType.Name == "Document")
           {
               file.Item["Name"] = properties.AfterUrl.Replace("/", "-");
               file.Item.Update();
           }
       }

}

Next sample I can automatic update file name, when I updated name folder on my library documents.

I been used class SPFileCollection and method GetFolder for gets properties updated folder on Sharepoint 2010.

SPFileCollection – Represents a collection of SPFile objects.

Use the Files property of either the SPWeb or SPFolder class to return the collection of files for the site or folder. To create a new file, use one of the Add methods of SPFileCollection.

Use an indexer to return a single file from the collection. For example, assuming the collection is assigned to a variable named collFiles, use collFiles[index] in C#, or collFiles(index) in Visual Basic, where index is either the index number of the file in the collection or the display name of the file

This sample automatic update file name, when updated name folder document library Sharepoint 2010.

       /// <summary>
      /// An item was updated
      /// </summary>
      public override void ItemUpdated(SPItemEventProperties properties)
      {
          base.ItemUpdated(properties);

          SPFile file = properties.Web.GetFile(properties.ListItem.Url);
          if (file.Item.ContentType.Name == "Folder")
          {

              SPFileCollection fileCollection = properties.Web.GetFolder(properties.ListItem.Url).Files;

              foreach (SPFile fileItem in fileCollection)
              {
                  fileItem.Item["Name"] = fileItem.Item.Name + properties.AfterUrl.Replace("/", "-");
                  file.Item.Update();
              }
          }

      }

That’s all. If you can automatic update name folder on library Sharepoint 2010, else you can write this code:

SPFolder.Name = "NewFolderName";

SPFolder.MoveTo("brandspakningnewSPFolder.Name");