protected void GrdClients_PageIndexChanging(object sender, GridViewPageEventArgs e) { GrdClients.PageIndex = e.NewPageIndex; dt = s.SearchBySql("Select * from Clients WHERE [Status]='Online'", "Clients"); GrdClients.DataSource = dt; GrdClients.DataBind(); }
//private DataTable dt = null; private void Show(string sql, int status) { if (status == 1) { dt = s.SearchBySql(sql, "Clients"); if (dt.Rows.Count == 0) { lbldidnt.Visible = true; } else { lbldidnt.Visible = false; txtuser.Text = dt.Rows[0][0].ToString(); txtfname.Text = dt.Rows[0][2].ToString(); txtlname.Text = dt.Rows[0][3].ToString(); dropCity.SelectedIndex = int.Parse(dt.Rows[0][5].ToString()); txtmail.Text = dt.Rows[0][9].ToString(); img1.ImageUrl = "~/pics/users/" + dt.Rows[0][11].ToString(); GrdClients.DataSource = dt; GrdClients.DataBind(); for (int i = 0; i < GrdClients.Rows.Count; i++) { GrdClients.Rows[i].Cells[5].Text = s.CityFromid(int.Parse(GrdClients.Rows[i].Cells[5].Text)); } } } else { txtuser.Text = string.Empty; txtfname.Text = string.Empty; txtlname.Text = string.Empty; dropCity.SelectedIndex = 0; txtmail.Text = string.Empty; img1.ImageUrl = "~/pics/users/default.jpg"; dt = s.SearchBySql(sql, "Clients"); GrdClients.DataSource = dt; GrdClients.DataBind(); for (int i = 0; i < GrdClients.Rows.Count; i++) { GrdClients.Rows[i].Cells[5].Text = s.CityFromid(int.Parse(GrdClients.Rows[i].Cells[5].Text)); } } }