private void _Bind() { try { if (grdCityList.DataSourceID.Length >= 1) { grdCityList.DataSourceID.Remove(0, grdCityList.DataSourceID.Length); } objAppAdmin.CityName = txtSearchBox.Text; dt = objAppAdmin.GetCityList(objAppAdmin); grdCityList.DataSourceID = ""; if (dt == null || dt.Rows.Count == 0) { dt = _CreateEmptyTable(); } DataView dv = dt.DefaultView; if (this.ViewState["SortExp"] == null) { this.ViewState["SortExp"] = "CityName"; this.ViewState["SortOrder"] = "ASC"; } else { dv.Sort = this.ViewState["SortExp"] + " " + this.ViewState["SortOrder"]; } grdCityList.DataSource = dv; grdCityList.DataBind(); } catch (Exception ex) { Helper.Log(ex.Message, "CityList/_Bind()"); } }