/// <summary> /// Lấy ra các cấu hình theo đường đẫn của control cha /// </summary> /// <param name="vsdesc">Đường dẫn của control cha, vd: cms/admin/Moduls/FileLibrary/Index.ascx</param> private void LoadConfigs(string vsdesc) { string split = "->"; DataTable dt = new DataTable(); dt = Settings.GetSettingsCondition("", SettingsColumns.VsvalueColumn, SettingsTSql.GetSettingsByVsdesc(vsdesc), SettingsColumns.VsvalueColumn); string child = ""; string status = ""; string[] list = new string[4]; for (int i = 0; i < dt.Rows.Count; i++) { list = dt.Rows[i][SettingsColumns.VsvalueColumn].ToString().Split(new string[] { split }, StringSplitOptions.None); child = list[2]; status = list[3]; if (status == "1") { try { plLoadControls.Controls.Add(LoadControl("~/" + child)); } catch (Exception) { } } } }
/// <summary> /// Lấy ra các cấu hình theo đường đẫn của control cha /// </summary> /// <param name="vsdesc">Đường dẫn của control cha, vd: cms/admin/Moduls/New/Index.ascx</param> private void LoadConfigs(string vsdesc) { string split = "->"; DataTable dt = new DataTable(); dt = Settings.GetSettingsCondition("", SettingsColumns.VsvalueColumn, SettingsTSql.GetSettingsByVsdesc(vsdesc), SettingsColumns.VsvalueColumn); string order = ""; string fullkey = ""; string status = ""; string[] list = new string[4]; foreach (Control pnConfig in pnCauHinhTrangChu.Controls) { if (typeof(System.Web.UI.WebControls.Panel) == pnConfig.GetType()) { HiddenField hd1 = new HiddenField(); TextBox tb1 = new TextBox(); CheckBox cb1 = new CheckBox(); foreach (Control pnSubConfig in pnConfig.Controls) { if (typeof(System.Web.UI.WebControls.HiddenField) == pnSubConfig.GetType()) { hd1 = (HiddenField)pnSubConfig; } if (typeof(System.Web.UI.WebControls.TextBox) == pnSubConfig.GetType()) { tb1 = (TextBox)pnSubConfig; } if (typeof(System.Web.UI.WebControls.CheckBox) == pnSubConfig.GetType()) { cb1 = (CheckBox)pnSubConfig; } for (int i = 0; i < dt.Rows.Count; i++) { list = dt.Rows[i][SettingsColumns.VsvalueColumn].ToString().Split(new string[] { split }, StringSplitOptions.None); order = list[0]; fullkey = list[1] + split + list[2]; status = list[3]; if (hd1.Value.Equals(fullkey, StringComparison.CurrentCultureIgnoreCase)) { tb1.Text = order; cb1.Checked = status == "1"; } } } } } }