本文整理汇总了C#中System.Web.UI.StateBag.Add方法的典型用法代码示例。如果您正苦于以下问题:C# StateBag.Add方法的具体用法?C# StateBag.Add怎么用?C# StateBag.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.StateBag
的用法示例。
在下文中一共展示了StateBag.Add方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeserializeStateBag
public static StateBag DeserializeStateBag(SerializationReader reader)
{
var flags = reader.ReadOptimizedBitVector32();
var stateBag = new StateBag(flags[StateBagIsIgnoreCase]);
if (flags[StateBagHasDirtyEntries])
{
var count = reader.ReadOptimizedInt32();
for(var i = 0; i < count; i++)
{
var key = reader.ReadOptimizedString();
var value = reader.ReadObject();
// ReSharper disable PossibleNullReferenceException
stateBag.Add(key, value).IsDirty = true;
// ReSharper restore PossibleNullReferenceException
}
}
if (flags[StateBagHasCleanEntries])
{
var count = reader.ReadOptimizedInt32();
for(var i = 0; i < count; i++)
{
var key = reader.ReadOptimizedString();
var value = reader.ReadObject();
stateBag.Add(key, value);
}
}
return stateBag;
}
示例2: WebPartVerb
public WebPartVerb (string id, WebPartEventHandler serverClickHandler, string clientClickHandler) {
this.id = id;
this.serverClickHandler = serverClickHandler;
this.clientClickHandler = clientClickHandler;
stateBag = new StateBag ();
stateBag.Add ("serverClickHandler", serverClickHandler);
stateBag.Add ("clientClickHandler", clientClickHandler);
}
示例3: WebPartVerb
public WebPartVerb (string clientHandler)
{
this.clientClickHandler = clientHandler;
stateBag = new StateBag ();
stateBag.Add ("clientClickHandler", clientHandler);
}
示例4: NextTempRecId
internal static int NextTempRecId(StateBag viewState)
{
if (viewState["TempRecId"] != null)
{
int RecId = Convert.ToInt32(viewState["TempRecId"]) + 1;
viewState.Add("TempRecId", RecId);
return RecId;
}
else
{
viewState.Add("TempRecId", 1);
return 1;
}
}
示例5: IDictionary_Deny_Unrestricted
public void IDictionary_Deny_Unrestricted ()
{
IDictionary d = new StateBag ();
d.Add ("key", "value");
Assert.IsTrue (d.Contains ("key"), "Contains");
Assert.AreEqual (1, d.Count, "Count");
d.Remove ("key");
d["key"] = "value";
Assert.AreEqual ("value", d["key"], "this[string]");
d.Clear ();
Assert.IsFalse (d.IsFixedSize, "IsFixedSize");
Assert.IsFalse (d.IsReadOnly, "IsReadOnly");
ICollection c = (d as ICollection);
Assert.IsFalse (c.IsSynchronized, "IsSynchronized");
Assert.IsNotNull (c.SyncRoot, "SyncRoot");
}
示例6: Deny_Unrestricted
public void Deny_Unrestricted ()
{
StateBag bag = new StateBag (true);
Assert.IsNotNull (bag.Add ("key", "value"), "Add");
Assert.AreEqual (1, bag.Count, "Count");
Assert.IsNotNull (bag.GetEnumerator (), "GetEnumerator");
bag.SetItemDirty ("key", true);
Assert.IsTrue (bag.IsItemDirty ("key"), "IsItemDirty");
bag.Remove ("key");
bag.Clear ();
bag["key"] = "value";
Assert.IsNotNull (bag["key"], "this[string]");
Assert.IsNotNull (bag.Keys, "Keys");
Assert.IsNotNull (bag.Values, "Values");
bag.SetDirty (true);
}
示例7: DeserializeStateBag
public static StateBag DeserializeStateBag(SerializationReader reader)
{
BitVector32 flags = reader.ReadOptimizedBitVector32();
StateBag stateBag = new StateBag(flags[StateBagIsIgnoreCase]);
if (flags[StateBagHasDirtyEntries])
{
int count = reader.ReadOptimizedInt32();
for(int i = 0; i < count; i++)
{
string key = reader.ReadOptimizedString();
object value = reader.ReadObject();
stateBag.Add(key, value).IsDirty = true;
}
}
if (flags[StateBagHasCleanEntries])
{
int count = reader.ReadOptimizedInt32();
for(int i = 0; i < count; i++)
{
string key = reader.ReadOptimizedString();
object value = reader.ReadObject();
stateBag.Add(key, value);
}
}
return stateBag;
}
示例8: WriteOption
/// <summary>
/// Writes the option.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="writer">The writer.</param>
private void WriteOption(ExtendedListItem item, HtmlTextWriter writer)
{
writer.WriteBeginTag("option");
if (item.Selected)
{
if (_selected)
{
this.VerifyMultiSelect();
}
_selected = true;
writer.WriteAttribute("selected", "selected");
}
if (!string.IsNullOrEmpty(item.CssClass))
writer.WriteAttribute("class", item.CssClass);
writer.WriteAttribute("value", item.Value, true);
if (item.Attributes.Count > 0)
{
StateBag bag = new StateBag();
foreach (string attrKey in item.Attributes.Keys)
{
if (attrKey.IndexOf(ExtendedListItem._attrPrefix) == -1)
bag.Add(attrKey, item.Attributes[attrKey]);
}
System.Web.UI.AttributeCollection coll = new System.Web.UI.AttributeCollection(bag);
coll.Render(writer);
}
if (this.Page != null)
{
this.Page.ClientScript.RegisterForEventValidation(this.UniqueID, item.Value);
}
writer.Write('>');
HttpUtility.HtmlEncode(item.Text, writer);
writer.WriteEndTag("option");
writer.WriteLine();
}