How to check if FormView is free of code

How can I check if the form view is empty from code? I've tried DataItemCount == 0 but it doesn't work. Thanks to

if (FormView_imgBG.DataItemCount == 0)

            { //do stuff
            }
            else 

            {                 
            // do other stuff
            }

      

+3


source to share


1 answer


People say that the best place to check the DataItemCount property is in the FormView.DataBound event.



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

      

+2


source







All Articles