コード例 #1
0
    private void _Bind()
    {
        try
        {
            if (grd_CityAdminList.DataSourceID.Length >= 1)
            {
                grd_CityAdminList.DataSourceID.Remove(0, grd_CityAdminList.DataSourceID.Length);
            }

            objAppAdmin.AdminName = txt_SearchName.Text;
            objAppAdmin.CityId    = Convert.ToInt32(ddl_SearchCity.SelectedValue);

            dt = objAppAdmin.GetAllAdminDetails(objAppAdmin);


            grd_CityAdminList.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_CityAdminList.DataSource = dv;
            grd_CityAdminList.DataBind();
        }
        catch (Exception ex)
        {
            Helper.Log(ex.Message, "CityAdmin/_Bind()");
        }
    }