for (int i=0;i<=Session.Count-1;i++)
{
Response.Write(Session[i].ToString());
}
{
Response.Write(Session[i].ToString());
}
解决方案 »
- 关于使用COOKIES未将对象使用到实例的问题
- PlaceHolder 控件中的按钮没有事件吗?
- 第一天学习.net的第一个问题
- Datagrid中的绑定列RadioButtonList的赋值问题,请大家指点
- DataGird如何动态加入超链接列
- 一个关于 innerHTML 效率的问题
- 有关Request.UserHostAddress。为什么得到的都是同一个IP地址(DNS的IP)
- 关于VS2013本地数据库创建表的问题
- 急,大虾帮忙,一个错误提示
- 如何自动生成缩略图?(事先没有缩略图)
- DataGrid 里的 CheckBox 的问题
- 如何在选定DataGrid 里的CheckBox 后即刻更新相对应的数据库里值
Session["b"] = "b";for (int i=0;i<=Session.Count-1;i++)
{
Response.Write(Session[i].ToString());
}
It is ok!
{
object key = item.Key; //获取键
object value = item.Value; //获取值
}
AspNetPager 免费分页控件4.1版发布,欢迎下载使用:http://www.webdiyer.com
DictionaryEntry 成员 | System.Collections 命名空间 | IDictionary | IDictionaryEnumerator
要求
命名空间: System.Collections平台: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows .NET Server family程序集: Mscorlib (在 Mscorlib.dll 中)
语言
C#C++JScriptVisual Basic全部显示
定义可设置或检索的字典键值对。有关此类型所有成员的列表,请参阅 DictionaryEntry 成员。System.Object
System.ValueType
System.Collections.DictionaryEntry[Visual Basic]
<Serializable>
Public Structure DictionaryEntry
[C#]
[Serializable]
public struct DictionaryEntry
[C++]
[Serializable]
public __value struct DictionaryEntry
[JScript] 在 JScript 中,可以使用 .NET 框架中的结构,但不能定义自己的结构。线程安全
此类型的公共静态(在 Visual Basic 中为 Shared)成员对于多线程操作是安全的。不能保证实例成员是线程安全的。备注
IDictionaryEnumerator.Entry 方法返回此类的实例。C# 语言中的 foreach 语句(在 Visual Basic 中为 for each)需要集合中每个元素的类型。由于基于 IDictionary 的集合中的每个元素都是键/值对,因此元素类型既不是键的类型也不是值的类型。而是 DictionaryEntry 类型。例如,foreach (DictionaryEntry myEntry in myHashtable) {...}
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/converttoaspnet.asp
2. use hidden controlsTransfer Session Variables from Classic ASP to ASP.NET
http://www.eggheadcafe.com/articles/20021207.asp
象
for (int i=0;i<=Session.Count-1;i++)
{
Response.Write(Session[i].ToString());
}
还是还可以很方便的遍历其它树组而不必知道数组中元素的类型。
{
int cou=Session.Keys.Count;
for(int i=0;i<cou;i++)
{
TableRow tr=new TableRow();
TableCell tck=new TableCell();
TableCell tcv=new TableCell();
TableCell tcb=new TableCell();
Label lbkey=new Label();
Label lbv=new Label();
//Button bt=new Button(); lbkey.Text=Session.Keys[i].ToString();
lbv.Text=Session[i].ToString();
//bt.Text="修改"; tck.Controls.Add(lbkey);
tcv.Controls.Add(lbv);
//tcb.Controls.Add(bt); tr.Cells.Add(tck);
tr.Cells.Add(tcv);
tr.Cells.Add(tcb); this.Table1.Rows.Add(tr);
}
}