日期:2014-05-19  浏览次数:20476 次

传递数组问题:在服务器端动态生成了一个数组,要传递到DataGrid_ItemDataBound 事件里用,该如何处理?
用cache   对象、response等都只能传递固定的几个,可是对于数组如何传递哪?


比如   在   DataGrid_ItemDataBound   事件里

e.Item.Cells(0).Text   =   HttpContext.Current.Cache( "FieldNameChinese ")
这样只可以给一个啊,那么多个怎么给?因为是动态生成的数组,也不能一个一个去给,怎么实现哪?

俺是菜鸟,没想出来,请大侠们帮忙



------解决方案--------------------
写个静态类。里面声明个静态数组成员,用与存放你的数据!
------解决方案--------------------
不太明白什么意思 能说得明白点吗? 具体需求。
------解决方案--------------------
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;
/// <summary>
/// news_htm 的摘要说明
/// </summary>

public static class news_htm
{
public static ArrayList a = new ArrayList();
public static void add()
{
//你的处理
}
}

------解决方案--------------------
mark
------解决方案--------------------
mark
------解决方案--------------------


If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Then
e.Item.Cells(0).Text = strSql '运行到此处strSql 就是空
'我是想在这里修改表格头为中文,输出FieldNameArray() 到表格列头
'但是这里strSql 都为空,那我就不能这样用了,所有用
e.Item.Cells(0).Text = HttpContext.Current.Cache( "strSql ") '当然前面还要加上输出strSql的句子
End If