Exemple #1
0
    private void _Bind()
    {
        try
        {
            if (grd_CityList.DataSourceID.Length >= 1)
            {
                grd_CityList.DataSourceID.Remove(0, grd_CityList.DataSourceID.Length);
            }

            objAppAdmin.CityName        = txtSearchBox.Text;
            objAppAdmin.IsParticipating = chkIsParticipatingCity.Checked;

            dt = objAdmin.GetCityListCityMaster(objAppAdmin);


            grd_CityList.DataSourceID = "";

            if (dt == null || dt.Rows.Count == 0)
            {
                dt = _CreateEmptyTable();
            }

            DataView dv = dt.DefaultView;
            if (this.ViewState["SortExp"] == null)
            {
                //this.ViewState["SortExp"] = "make";
                //this.ViewState["SortOrder"] = "ASC";
            }
            else
            {
                dv.Sort = this.ViewState["SortExp"] + " " + this.ViewState["SortOrder"];
            }

            grd_CityList.DataSource = dv;
            grd_CityList.DataBind();
        }
        catch (Exception ex)
        {
            Helper.Log(ex.Message, "CityMaster/_Bind()");
        }
    }