How can I check if a Form View is empty from code behind? I've tried DataItemCount ==0 but it doesn't seem to work. Thanks
如何检查表单视图是否为空?我试过DataItemCount =0,但是好像不太好用。谢谢
if (FormView_imgBG.DataItemCount == 0)
{ //do stuff
}
else
{
// do other stuff
}
1 个解决方案
#1
2
People are saying that the best place to check the DataItemCount property is in the FormView.DataBound event.
人们说检查DataItemCount属性的最佳位置是在FormView中。数据绑定事件。
protected void FormView1_DataBound(object sender, EventArgs e) {
if (FormView1.DataItemCount == 0) {
}
else {
}
}
#1
2
People are saying that the best place to check the DataItemCount property is in the FormView.DataBound event.
人们说检查DataItemCount属性的最佳位置是在FormView中。数据绑定事件。
protected void FormView1_DataBound(object sender, EventArgs e) {
if (FormView1.DataItemCount == 0) {
}
else {
}
}