当前位置: 首页>>代码示例>>C#>>正文


C# ListItem.LoadViewState方法代码示例

本文整理汇总了C#中System.Web.UI.WebControls.ListItem.LoadViewState方法的典型用法代码示例。如果您正苦于以下问题:C# ListItem.LoadViewState方法的具体用法?C# ListItem.LoadViewState怎么用?C# ListItem.LoadViewState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.WebControls.ListItem的用法示例。


在下文中一共展示了ListItem.LoadViewState方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ArrayList

		void IStateManager.LoadViewState (object savedState)
		{
			Pair pair = savedState as Pair;
			if (pair == null)
				return;

			bool newCollection = (bool) pair.First;
			object [] itemsArray = (object []) pair.Second;
			int count = itemsArray==null ? 0 : itemsArray.Length;

			if (newCollection)
				if (count > 0)
					items = new ArrayList(count);
				else
					items = new ArrayList();

			for (int i = 0; i < count; i++) {
				ListItem item = new ListItem ();
				
				if (newCollection) {
					item.LoadViewState (itemsArray [i]);
					item.SetDirty ();
					Add (item);
				}
				else{
					if (itemsArray [i] != null){
						item.LoadViewState (itemsArray [i]);
						item.SetDirty ();
						items [i] = item;
					}
				}
			}
		}
开发者ID:nobled,项目名称:mono,代码行数:33,代码来源:ListItemCollection.cs

示例2: LoadViewState

 internal void LoadViewState(object state)
 {
     if (state != null)
     {
         if (state is Pair)
         {
             Pair pair = (Pair) state;
             ArrayList first = (ArrayList) pair.First;
             ArrayList second = (ArrayList) pair.Second;
             for (int i = 0; i < first.Count; i++)
             {
                 int num2 = (int) first[i];
                 if (num2 < this.Count)
                 {
                     this[num2].LoadViewState(second[i]);
                 }
                 else
                 {
                     ListItem item = new ListItem();
                     item.LoadViewState(second[i]);
                     this.Add(item);
                 }
             }
         }
         else
         {
             Triplet triplet = (Triplet) state;
             this.listItems = new ArrayList();
             this.saveAll = true;
             string[] strArray = (string[]) triplet.First;
             string[] strArray2 = (string[]) triplet.Second;
             bool[] third = (bool[]) triplet.Third;
             for (int j = 0; j < strArray.Length; j++)
             {
                 this.Add(new ListItem(strArray[j], strArray2[j], third[j]));
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:39,代码来源:ListItemCollection.cs

示例3: LoadViewState

        internal void LoadViewState(object state) {
            if (state != null) {
                if (state is Pair) {
                    // only changed items were saved
                    Pair p = (Pair) state;
                    ArrayList indices = (ArrayList) p.First;
                    ArrayList items = (ArrayList) p.Second;

                    for (int i=0; i<indices.Count; i++) {
                        int index = (int) indices[i];

                        if (index < Count)
                            this[index].LoadViewState(items[i]);
                        else {
                            ListItem li = new ListItem();
                            li.LoadViewState(items[i]);
                            Add(li);
                        }
                    }
                }
                else {
                    // all items were saved
                    Triplet t = (Triplet) state;

                    listItems = new ArrayList();
                    saveAll = true;

                    string[] texts  = (string[]) t.First;
                    string[] values = (string[]) t.Second;
                    bool[] enabled  = (bool[]) t.Third;

                    for (int i=0; i < texts.Length; i++) {
                        Add(new ListItem(texts[i], values[i], enabled[i]));
                    }
                }
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:37,代码来源:ListItemCollection.cs

示例4: LoadViewState

		internal void LoadViewState (object savedState)
		{
			if (savedState == null)
				return;

			int i, end;
			if (savedState is Pair) {
				Pair pair = (Pair) savedState;
				ArrayList indices = (ArrayList) pair.First;
				ArrayList states  = (ArrayList) pair.Second;

				end = indices.Count;
				for (i = 0; i < end; i++) {
					if ((int) indices [i] < Count ) {
						this [(int) indices [i]].LoadViewState (states [i]);
					} else {
						ListItem temp = new ListItem ();
						temp.LoadViewState (states [i]);
						Add (temp);
					}
				}
			} else if (savedState is Triplet) {
				Triplet t = (Triplet) savedState;
				items = new ArrayList ((int) t.First);
				saveAll = true;
				object [] text = (object []) t.Second;
				object [] vals = (object []) t.Third;
				end = text.Length;
				for(i = 0; i < end; i++)
					items.Add (new ListItem (text[i].ToString (), vals[i].ToString ()));
			}
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:32,代码来源:ListItemCollection.cs


注:本文中的System.Web.UI.WebControls.ListItem.LoadViewState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。