private void LoadProductListView(GridView girdView) { try { string _sql = @"select ProductID,ProductName,QuantityPerUnit,UnitPrice,UnitsOnOrder,Discontinued from dbo.Products"; DataTable _table = sqlHelper.ExecuteDataTable(_sql, null); girdView.SetDataSource(_table); } catch (System.Exception ex) { ClientScriptHelper.Alert(ex.Message.Trim()); } }
private void LoadProductListView(GridView girdView, string orderByColumnName, OrderType orderWay) { try { string _sql = @"select ProductID,ProductName,QuantityPerUnit,UnitPrice,UnitsOnOrder,Discontinued from dbo.Products"; DataTable _table = sqlHelper.ExecuteDataTable(_sql, null); DataView _dataView = new DataView(_table); _dataView.Sort = string.Format("{0} {1}", orderByColumnName, orderWay); girdView.SetDataSource(_dataView); } catch (System.Exception ex) { ClientScriptHelper.Alert(ex.Message.Trim()); } }