System.Web.UI.WebControls.TreeView.LoadPostData C# (CSharp) Method

LoadPostData() protected method

protected LoadPostData ( string postDataKey, NameValueCollection postCollection ) : bool
postDataKey string
postCollection NameValueCollection
return bool
		protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
		{
			bool res = false;

			if (EnableClientScript && PopulateNodesFromClient) {
				string states = postCollection [ClientID + "_PopulatedStates"];
				if (states != null) {
					foreach (string id in states.Split (postDataSplitChars, StringSplitOptions.RemoveEmptyEntries)) {
						TreeNode node = FindNodeByPos (id);
						if (node != null && node.PopulateOnDemand && !node.Populated) {
							Page page = Page;
							if (page != null && page.IsCallback)
								node.Populated = true; // Bug #492307
							else
								node.Populate (); // Bug #626829
						}
					}
				}
				res = true;
			}

			UnsetCheckStates (Nodes, postCollection);
			SetCheckStates (postCollection);
			
			if (EnableClientScript) {
				string states = postCollection [ClientID + "_ExpandStates"];
				if (states != null) {
					string[] ids = states.Split (postDataSplitChars, StringSplitOptions.RemoveEmptyEntries);
					UnsetExpandStates (Nodes, ids);
					SetExpandStates (ids);
				} else
					UnsetExpandStates (Nodes, new string[0]);
				res = true;
			}
			return res;
		}