protected void RadGrid1_OnNeedDataSource(object sender, GridNeedDataSourceEventArgs e) { var presenter = new PMPhong(this); DataTable dt; if (txtsearch.Text == "") { dt = presenter.List(null); } else { dt = presenter.List(txtsearch.Text); } RadGrid1.DataSource = dt; }
protected void txtsearch_OnTextChanged(object sender, EventArgs e) { var presenter = new PMPhong(this); DataTable dt; dt = presenter.List(txtsearch.Text); RadGrid1.DataSource = dt; RadGrid1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { var presenter = new PMPhong(this); var dsPhong = presenter.List(null); string[] romicon = { "fa fa-play", "fa fa-bookmark", "fa fa-pause" }; string[] romstate = { "Phòng trống", "Đã đặt trước", "Đang có khách" }; var col = 0; string idstring = null; foreach (DataRow item in dsPhong.Rows) { if (col % 4 == 0) //1 dong 4 cot { CreateDiv(("divrow_" + col / 4), "superDiv", "row top_tiles", ""); } var currentrow = FindControl("divrow_" + col / 4); idstring = item["ID"].ToString(); //item tung cot CreateDiv("rom_boss" + idstring, ("divrow_" + col / 4), "animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12 hihi", ""); CreateDiv("rom" + idstring, "rom_boss" + idstring, "tile-stats", ""); CreateDiv("rom_icon" + idstring, "rom" + idstring, "icon", ""); CreateDiv("rom_count" + idstring, "rom" + idstring, "count", item["Ten"].ToString()); var status = Convert.ToInt32(item["StatusID"].ToString()); FindControl("rom" + idstring).Controls.Add(new LiteralControl("<h3>" + romstate[status - 1] + "</h3>")); FindControl("rom_icon" + idstring) .Controls.Add(new LiteralControl("<i class='" + romicon[status - 1] + "'></i>")); col++; } ((Default2)Page).SetTitle("Quản lý phòng"); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "loadjs", "phong_ready();", true); }