How can you force an ASP.Net GridView to display an EmptyDataTemplate given there's only a single data record with all blanks? -
my stored procedure, instead of returning 0 rows, returns 1 of columns null. when .net code sees such data, wish force display emptydatatemplate. how?
thanks win,
in linqdatasource selecting event handler check if data source has size of 1 , has null value 1 of key fields , pass in linqdatasourceselecteventargs' result:
using (var datacontext = new webdatacontext()) { var report = row in datacontext.getreport() select new report() { accountcode = row.accountcode //, //... } } if (report.count() == 1 && report.tolist()[0].accountcode == null) { var emptyreport = report.tolist(); report.clear(); e.result = emptyreport; } else { //... e.result = matrixreport; //... }
Comments
Post a Comment