本文整理汇总了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;
}
}
}
}
示例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]));
}
}
}
}
示例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]));
}
}
}
}
示例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 ()));
}
}