Asp.Net Repeater ItemCommand 数据项始终为 null

标签 asp.net repeater

在转发器 rpt_ItemCommand 事件中,e.Item.DataItem 始终为 null。

这是背后的代码:

protected void rpt_ItemCommand(Object sender, RepeaterCommandEventArgs e)
{
    DataRowView drv = (DataRowView)e.Item.DataItem // here the DataItem is Null.
}

向我提出任何解决方案。

最佳答案

DataItem 属性始终为 null,但 ItemDataBound 除外...这是 Microsoft 设计的。

关于Asp.Net Repeater ItemCommand 数据项始终为 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17781203/

相关文章:

asp.net - 将代码更改部署到 IIS 中托管的 asp.net 网站

c# - 使用 ChartColorPalette 时如何在运行时读取 Series.Color?

asp.net - 在转发器项目中使用 JQuery 更新/删除数据库记录

c# - 将 IQueryable 集合导出到 Excel

asp.net - 我可以动态更改嵌套母版页的母版吗?

ASP.NET Repeater 中的 javascript 函数

sql - 使用 SQL 查询包含重复数据的 XML

asp.net - 如何将 ASP.NET 中继器控件绑定(bind)到 IList<String>?

asp.net - 为什么应用于 Repeater Control 的 <DIV> CSS 放在 UpdatePanel 中时会失真?

asp.net - SSRS : Why do SKA-cookies build up until "HTTP 400 Bad Request - Request Too Long" occurs?