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

if (FormView_imgBG.DataItemCount == 0)

            { //do stuff
            }
            else

            {
            // do other stuff
            }

最佳答案

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

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

关于c# - 如何从后面的代码检查 FormView 是否为空,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25098032/

10-12 04:16