Carrotware.Web.UI.Controls.CarrotGridView.SetData C# (CSharp) Метод

SetData() приватный Метод

private SetData ( ) : void
Результат void
        private void SetData()
        {
            SetTemplates();

            if (!string.IsNullOrEmpty(DefaultSort) && this.DataSource != null) {
                Type theType = this.DataSource.GetType();

                if (theType.IsGenericType && theType.GetGenericTypeDefinition() == typeof(List<>)) {
                    IList lst = (IList)this.DataSource;
                    SortParm = DefaultSort;
                    var lstVals = SortDataListType(lst);

                    this.DataSource = lstVals;
                }

                if (this.DataSource is DataSet || theType == typeof(DataSet)) {
                    DataSet ds = (DataSet)this.DataSource;
                    if (ds.Tables.Count > 0) {
                        SortParm = DefaultSort;
                        DataTable dt = ds.Tables[0];
                        var dsVals = SortDataTable(dt);

                        this.DataSource = dsVals;
                    }
                }

                if (this.DataSource is DataTable || theType == typeof(DataTable)) {
                    DataTable dt = (DataTable)this.DataSource;
                    SortParm = DefaultSort;
                    var dsVals = SortDataTable(dt);

                    this.DataSource = dsVals;
                }
            }
        }