Click here to Skip to main content
15,884,473 members
Articles / Web Development / HTML

Runtime Dependent ListBox

Rate me:
Please Sign up or sign in to vote.
3.00/5 (3 votes)
29 May 20071 min read 39.9K   743   18  
This articles describles how to add a Dependent ListBox in Runtime using Ajax (MagicAjax)
using System;
using System.Web;
using System.Web.UI.WebControls.WebParts;
using System.Web.Hosting;

public class SessionPersonalizationProvider : PersonalizationProvider
{
	protected override void LoadPersonalizationBlobs(WebPartManager webPartManager, string path, string userName, ref byte[] sharedDataBlob, ref byte[] userDataBlob)
	{
		object blob = HttpContext.Current.Session[path];
		if (blob != null)
		{
			userDataBlob = (byte[])blob;
		}
	}

	protected override void ResetPersonalizationBlob(WebPartManager webPartManager, string path, string userName)
	{
		SavePersonalizationBlob(webPartManager, path, userName, null);
	}

	protected override void SavePersonalizationBlob(WebPartManager webPartManager, string path, string userName, byte[] dataBlob)
	{
		HttpContext.Current.Session.Add(path, dataBlob);
	}

	private string _applicationName;
	public override string ApplicationName
	{
		get
		{
			if (string.IsNullOrEmpty(_applicationName))
			{
				_applicationName = HostingEnvironment.ApplicationVirtualPath;
			}
			return _applicationName;
		}
		set
		{
			_applicationName = value;
		}
	}

	public override int GetCountOfState(PersonalizationScope scope, PersonalizationStateQuery query)
	{
		throw new NotImplementedException();
	}

	public override PersonalizationStateInfoCollection FindState(PersonalizationScope scope, PersonalizationStateQuery query, int pageIndex, int pageSize, out int totalRecords)
	{
		throw new NotImplementedException();
	}

	public override int ResetState(PersonalizationScope scope, string[] paths, string[] usernames)
	{
		throw new NotImplementedException();
	}

	public override int ResetUserState(string path, DateTime userInactiveSinceDate)
	{
		throw new NotImplementedException();
	}
}

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
Software Developer I.ndigo - www.i.ndigo.com.br
Brazil Brazil
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions