private void FillDataSource() { try { if (ViewState["SqlString"] != null && ViewState["SqlString"].ToString() != "") { int TotalRecordCount = 0; string _sqlstring = ViewState["SqlString"].ToString(); if (ConditionString != "") { _sqlstring += " WHERE " + ConditionString; } string DBConnectString = null; if (ViewState["DBConnectString"] != null) { DBConnectString = (string)ViewState["DBConnectString"]; } if (AllowPaging) { DataSource = TreeTableBLL.ExecSqlString(DBConnectString, _sqlstring, PageSize, PageIndex, OrderFields, out TotalRecordCount); } else { DataSource = TreeTableBLL.ExecSqlString(DBConnectString, _sqlstring, 999999, 0, OrderFields, out TotalRecordCount); } ViewState["TotalRecordCount"] = TotalRecordCount; } } catch (System.Exception err) { LogWriter.WriteLog("UC_GridView.FillDataSource: TreeTableBLL.ExecSqlString Error!", err); LogWriter.WriteLog(ViewState["SqlString"].ToString()); } }