【问题标题】:Accessing current item from ListView data source从 ListView 数据源访问当前项目
【发布时间】:2011-01-23 09:07:34
【问题描述】:

我认为这不会太难做到,但我似乎无法弄清楚如何做到这一点。有没有办法从 ListView 数据源轻松访问当前项目?例如,您可以使用Eval("propertyName") 轻松评估当前项目的属性,但有没有办法访问对象本身?

如果这不可能,我最终想要做的是获取对象的类型。

【问题讨论】:

    标签: c# asp.net listview datasource


    【解决方案1】:

    使用 FindControl 方法。

    例如,

    int index=0; // obtain the index of an item. 
    TextBox num = (TextBox)ListView1.Items[index].FindControl("numTextBox");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-04-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-06
      • 1970-01-01
      • 2015-05-14
      • 1970-01-01
      相关资源
      最近更新 更多