【发布时间】:2011-09-13 19:18:22
【问题描述】:
我已经写了这么多......但是我如何将 encryptedstatusid 分配给 listDTO 以进行数据绑定?
protected void Page_Load(object sender, EventArgs e)
{
List<DTO> listDto;
IApplication engine;
try
{
engine = new Engine();
listDto = engine.ReadHistory(Session["UserID"].ToString());
foreach (DTO iterDTO in listDto)
{
iterDTO.EncryptedStatusId = Triple.Encrypt(iterDTO.StatusId.ToString());
//how i assign the encryptedstatusid to the listDTO for databind?????????????
}
this.dvHistory.DataSource = listDto;
this.dvHistory.DataBind();
}
catch (Exception )
{
throw ;
}
finally
{
engine = null;
}
}
问题是我将 encryttedstatusid 获取到 iterDTO,但 satasource 是一个列表,我想分配 encry pted 状态 id 到 listDto,然后只有它会显示在网格中
【问题讨论】:
-
这段代码有什么问题?
EncryptedStatusId列是否数据绑定在您的 GridView 中? -
u cud 保留一个计数器并执行 listDTO[counter] = statusID,忘记不要增加计数器 ;)
标签: c# asp.net gridview datasource