我有一个asp.NET
应用程序,我使用LinqDataSource
控件来填充ListView
控件。这是我的LinqDataSource
控件的OnSelecting
命令的代码:
protected void lds_Selecting(object sender, LinqDataSourceSelectEvenArgs e)
{
var db = new Models.EF.Entities();
e.Result = from x in db.Sliders
where x.IsPublic == true
select x;
}
这很好但现在我想在结果为空的情况下运行if语句。如何查看结果是否为空?
答案 0 :(得分:1)
使用let resultController = mainStoryboard.instantiateViewControllerWithIdentifier("SearchTableViewController") as! UITableViewController
self.searchController = UISearchController(searchResultsController: resultController)
//self.searchController.searchResultsUpdater = self
//self.searchController.delegate = self
//self.searchController.searchBar.delegate = self
self.searchController.searchBar.tintColor = UIColor.whiteColor()
self.searchController.searchBar.placeholder = "Search Outlets"
self.searchController.dimsBackgroundDuringPresentation = false
self.searchController.hidesNavigationBarDuringPresentation = false
self.definesPresentationContext = true
方法。另外,LinqDataSourceSelectEvenArgs
将数据存储为Any
,因此请使用object
获取可以运行as
的{{1}}:
IEnumerable<T>