示例#1
0
        /// <summary>
        /// Search city
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SearchCity(object sender, EventArgs e)
        {
            DataTable searchTBL = CityDAO.GetDataCityByName(txtSearch.Text.Trim());

            if (searchTBL.Rows.Count > 0)
            {
                GridView1.DataSource = searchTBL;
                GridView1.DataBind();
            }
            else
            {
                searchTBL.Rows.Add(searchTBL.NewRow());
                GridView1.DataSource = searchTBL;
                GridView1.DataBind();
                int columncount = GridView1.Rows[0].Cells.Count;
                GridView1.Rows[0].Cells.Clear();
                GridView1.Rows[0].Cells.Add(new TableCell());
                GridView1.Rows[0].Cells[0].ColumnSpan = columncount;
                GridView1.Rows[0].Cells[0].Text       = "No Records Found";
            }
        }