Click here to Skip to main content
15,896,410 members
Articles / Web Development / ASP.NET

Programatically include an ASP.NET UserControl in a Web Page

Rate me:
Please Sign up or sign in to vote.
4.71/5 (14 votes)
9 Mar 20024 min read 277.4K   2.1K   65  
A tutorial on how to programatically include an ASP.NET UserControl in a web page.
// Disclaimer and Copyright Information
// ADSIGroup.cs : 
//
// All rights reserved.
//
// Written by Pardesi Services, LLC
// Version 1.0
//
// Distribute freely, except: don't remove our name from the source or
// documentation (don't take credit for my work), mark your changes (don't
// get me blamed for your possible bugs), don't alter or remove this
// notice.
// No warrantee of any kind, express or implied, is included with this
// software; use at your own risk, responsibility for damages (if any) to
// anyone resulting from the use of this software rests entirely with the
// user.
//
// Send bug reports, bug fixes, enhancements, requests, flames, etc. to
// softomatix@pardesiservices.com
///////////////////////////////////////////////////////////////////////////////
//

using System;
using System.Diagnostics;
using System.DirectoryServices;
using System.Xml;

namespace ASPNet_App
{
	/// <summary>
	/// 
	/// </summary>
	public class ADSIGroup : ADSIObject
	{
		private string m_strName = "";
		private string m_strDistinguishedName = "";
		private string m_strDescription = "";
		private string m_strCreationDate = "";
		private string m_strLastChangeDate = "";
		private string m_strCN = "";

		public ADSIGroup()
		{
			// 
			// TODO: Add constructor logic here
			//
		}

		/// <summary>
		/// 
		/// </summary>
		public string CN
		{
			get
			{
				return this.m_strCN;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public string Name
		{
			get
			{
				return this.m_strName;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public string Description
		{
			get
			{
				return this.m_strDescription;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public string DistinguishedName
		{
			get
			{
				return this.m_strDistinguishedName;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public string CreattionDate
		{
			get
			{
				return this.m_strCreationDate;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public string LastChangeDate
		{
			get
			{
				return this.m_strLastChangeDate;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		protected override void ProcessUserData()
		{
			if (null == this.m_obPropertiesDoc)
			{
				return;
			}

			// Get login name..
			this.GetNodeValue("//adsi_object/description", ref this.m_strDescription);

			// Get display name
			this.GetNodeValue("//adsi_object/distinguishedname", ref this.m_strDistinguishedName);

			// Get first name
			this.GetNodeValue("//adsi_object/name", ref this.m_strName);

			// Get Last name
			this.GetNodeValue("//adsi_object/cn", ref this.m_strCN);

			// Get middle name
			this.GetNodeValue("//adsi_object/whenchanged", ref this.m_strLastChangeDate);

			// Get creation date
			this.GetNodeValue("//adsi_object/whencreated", ref this.m_strCreationDate);
		}
	}

}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
To learn more about us, Please visit us at http://www.netomatix.com

Comments and Discussions