Archive for Ottobre 4th, 2007

Call Master Page Public Property from aspx

Ottobre 4th, 2007

Description: To be used on an aspx page that needs to access Properties on a master page.

Link: http://www.codekeep.net/snippets/d9b424cb-9bc4-4417-b31f-9189c868ff19.aspx

            if ((Master as PublicWebSite.MasterPages.PublicWeb) != null)
            {
                (Master as PublicWebSite.MasterPages.PublicWeb).ShowCardCallout = false;
            }

Write (Serialize) XML

Ottobre 4th, 2007

Description: Writes the class to a file by serialized the member variable into xml data.

Link: http://www.codekeep.net/snippets/7563cfed-5ee2-4e87-8053-86f6586f3cdf.aspx

		public bool Write(string Filename)
		{
			try
			{
				XmlSerializer ser = new XmlSerializer(typeof(XMLProf));
				TextWriter tw = new StreamWriter(Filename, false);
				ser.Serialize(tw, this);
				tw.Close();
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message);
				return true;
			}
			return false;
		}