動的な結果を返す検索があります。そのため、結果が見つからない場合はラベルを表示しようとしています。私が抱えている問題は、結果が動的で型と等しくないため、結果を数える方法がわからないことです。
エラーメッセージは次のとおりです。
演算子 '!=' は System.Collections.Generic.List および int 型のオペランドには適用できません
if (Page.IsValid)
{
string keyword = txtSearch.Text.Trim();
List<dynamic> results = SearchItems(keyword);
List<dynamic> Cresults = SearchContacts(keyword);
if(results != 0 || Cresults !=0)
{
//bind and return
LVI.DataSource = results;
LVI.DataBind();
// System.Threading.Thread.Sleep(500);
//Contact Bind return
LVC.DataSource = Cresults;
LVC.DataBind();
// System.Threading.Thread.Sleep(250);
lvAdmin.DataSource = results;
lvAdmin.DataBind();
LVCAdmin.DataSource = Cresults;
LVCAdmin.DataBind();
}
else{
NoResults.Visible = true;
}