[英]getting values is stored in a Session variable object of array type… System.Collections.Generic.List
I want to show values saved in object of array type.. by doing 我想显示保存在数组类型对象中的值。
<body>objname.Names</body>
this gets printed on my HTML page System.Collections.Generic.List`1[System.String] 这被打印在我的HTML页面System.Collections.Generic.List`1 [System.String]
I'm not sure I understand your question. 我不确定我是否理解您的问题。 If you want to print the values of Names you can use this format.
如果要打印名称的值,则可以使用此格式。 Of course
objname
must be a protected or public member of the Page. 当然
objname
必须是Page的受保护成员或公共成员。
<body><%= string.Join(", ", objname.Names.ToArray()) %></body>
you should loop at minimum, or use a Data bindable control like DataList, DataGrid, Repeater etc... 您至少应循环播放,或使用可绑定数据的控件,例如DataList,DataGrid,Repeater等。
pseudo code: 伪代码:
foreach(object obj in objName)
{
Response.Write(String.Format("{0}<br />", obj.ToString())),
}
of course the result of obj.ToString()
depends very much on what kind of objects you have in your array or collection. 当然,
obj.ToString()
的结果在很大程度上取决于数组或集合中具有哪种对象。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.