protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { #region refactored //DataTable dtDept = UnitKerjaList().Tables[0]; //if (User.IsInRole("MIA")) //{ // MembershipHelper.GetCurrentUser(); // var rows = dtDept.Select("NAMA_SATKER = '" + Session["User.Dept"].ToString() + "'"); // dtDept = !rows.Any() ? null : rows.CopyToDataTable(); //} //rdcmbDept.DataSource = dtDept; //rdcmbDept.AllowCustomText = true; //rdcmbDept.DataValueField = "NAMA_SATKER"; //rdcmbDept.DataTextField = "NAMA_SATKER"; //rdcmbDept.MarkFirstMatch = true; //rdcmbDept.Filter = RadComboBoxFilter.Contains; //rdcmbDept.DataBind(); //rdcmbIKU.DataSource = UnitKerjaList().Tables[1]; //rdcmbIKU.AllowCustomText = true; //rdcmbIKU.MarkFirstMatch = true; //rdcmbIKU.DataValueField = "IKU_DESKRIPSI"; //rdcmbIKU.DataTextField = "IKU_DESKRIPSI"; //rdcmbIKU.Filter = RadComboBoxFilter.Contains; //rdcmbIKU.DataBind(); #endregion DataTable dtDept = MembershipHelper.FilterMia(UnitKerjaList().Tables[0], "NAMA_SATKER", "User.Dept"); Helper.Helper.PopuplateCombobox(rdcmbDept, dtDept, "NAMA_SATKER", "NAMA_SATKER", "[Pilih satuan kerja]"); Helper.Helper.PopuplateCombobox(rdcmbIKU, UnitKerjaList().Tables[1], "IKU_DESKRIPSI", "IKU_DESKRIPSI", "[Pilih IKU]"); Helper.Helper.PopulateCmbPeriode(rdPeriode); } Helper.GirdHelper.SetUpGrid(RadGrid1); }
protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { if (!e.IsFromDetailTable && Page.IsPostBack) { // string deptName = rdtextDept.Text; // string ikuName = rdtextIku.Text; string deptName = rdcmbDept.SelectedValue; string ikuName = rdcmbIKU.SelectedValue; System.Data.DataSet ds = SearchIKU(deptName, ikuName.Trim()); ViewState["DATA.RESULT"] = ds; #region refactored /* * DataTable dt = ds.Tables[0]; * * if (User.IsInRole("MIA")) * { * MembershipHelper.GetCurrentUser(); * if (dt.Rows.Count > 0) * { * var rows = dt.AsEnumerable() * .Where(x => x.Field<string>("NAMA_SATKER") == Session["User.Dept"].ToString()); * dt = !rows.Any() ? null : rows.CopyToDataTable(); * } * } */ #endregion DataTable dt = MembershipHelper.FilterMia(ds.Tables[0], "NAMA_SATKER", "User.Dept"); RadGrid1.DataSource = dt; //RadGrid1.DataSource = ds.Tables[0]; } }