【问题标题】:How to check if FormView is empty from code behind如何从后面的代码中检查 FormView 是否为空
【发布时间】:2014-08-02 18:15:15
【问题描述】:

如何从后面的代码中检查表单视图是否为空?我试过 DataItemCount ==0 但它似乎不起作用。谢谢

if (FormView_imgBG.DataItemCount == 0)

            { //do stuff
            }
            else 

            {                 
            // do other stuff
            }

【问题讨论】:

    标签: c# asp.net formview


    【解决方案1】:

    人们说检查 DataItemCount 属性的最佳位置是在 FormView.DataBound 事件中。

        protected void FormView1_DataBound(object sender, EventArgs e) {
            if (FormView1.DataItemCount == 0) {
            }
            else {
            }
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-05-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多