public AbstractComponent CreateLinkFile() { var container = new Ext.Net.Container { ID = "LinkFileContainer", Layout = "Fit" }; var fileLinkField = new Ext.Net.TextField { ID = "LinkFileField", FieldLabel = FieldLabel, ReadOnly = true, LabelWidth = 200, Padding = 5, Width = 500, AutoDataBind = true }; var fileLink = new Ext.Net.LinkButton { ID = "LinkFileButton", Text = FileName, PaddingSpec = "1 0 1 4", }; fileLinkField.LeftButtons.Add(fileLink); fileLink.Listeners.Click.Handler = ClickHandler; container.Items.Add(fileLinkField); return(container); }
protected void Page_Load(object sender, EventArgs e) { this.Panel1.MinHeight = 600; try { #if DEBUG #endif string connectionString = ConfigurationManager.ConnectionStrings["Kanban"].ConnectionString; SqlConnection conexion = new SqlConnection(connectionString); conexion.Open(); string query = "SELECT * FROM [Kanbanboard].[dbo].[COLUMNA]where IDBOARD=" + Session["boardid"]; //string query = "SELECT * FROM [Kanbanboard].[dbo].[COLUMNA]where IDBOARD=2 order by POSICION"; string query2 = "SELECT [NOMBRE] FROM [Kanbanboard].[dbo].[BOARDS] where IDBOARD=" + Session["boardid"]; //string query2 = "SELECT [NOMBRE] FROM [Kanbanboard].[dbo].[BOARDS] where IDBOARD=2"; SqlCommand cmd = new SqlCommand(query, conexion); SqlCommand cmd2 = new SqlCommand(query2, conexion); string boardname = cmd2.ExecuteScalar().ToString(); this.Panel1.Title = boardname; SqlDataAdapter ad = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); ad.Fill(dt); foreach (DataRow row in dt.Rows) { Literal ltr = new Literal(); //ltr.Text = "<ext:Panel ID=\"Panel" + (int)row["POSICION"] + "\"runat=\"server\" Title=\"archive\" BodyPadding=\"20\" Flex=\"1\" AutoScroll=\"True\" TitleAlign=\"Center\"></ext:Panel>"; Ext.Net.Panel p = new Ext.Net.Panel(); p.Title = row["NOMBRE"].ToString(); p.BodyPadding = 20; p.Flex = 1; p.AutoScroll = true; p.Cls = "draggable"; p.TitleAlign = Ext.Net.TitleAlign.Center; id.Add(p); Ext.Net.Container p1 = new Ext.Net.Container(); p1.Flex = 1; p1.Cls = "dropable"; p1.Layout = Ext.Net.LayoutType.Fit.ToString(); p1.Add(p); this.Panel1.Items.Add(p1); } this.Panel1.DataBind(); conexion.Close(); } catch (Exception ex) { MessageBoxShow(this, ex.StackTrace); } }
/// <summary> /// 提示信息 /// </summary> /// <param name="b">是否刷新父窗体</param> /// <param name="title">框体标题信息</param> /// <param name="msg">信息内容</param> /// <param name="container">信息容器</param> public static void pageTitleMsg(bool b, string title, string msg, Ext.Net.Container container) { X.AddScript("document.title='" + title + "';"); container.Html = msg; if (b) { X.AddScript("try{window.opener.Reload();} catch(e){}"); } //X.AddScript("if(this.opener==undefined){}else{this.opener.location.reload()}"); }
/// <summary> /// 提示信息 /// </summary> /// <param name="page">当前页面 this</param> /// <param name="msg">提示信息</param> /// <param name="container">信息容器</param> public static void pageTitleMsg(System.Web.UI.Page page, string msg, Ext.Net.Container container) { //Regex reg = new Regex("<[^>]*>", RegexOptions.Compiled); bool b = false; //X.AddScript("document.title='" + reg.Replace(msg, "") + "';"); string[] keys = page.Request.QueryString.AllKeys; foreach (string str in keys) { if (!string.IsNullOrEmpty(str)) { b = true; break; } } string title = b ? "Edit " : "New "; X.AddScript("document.title='" + title + page.Title + "';"); container.Html = msg; }
public void GetChildControl(Ext.Net.Component wrapperComponent) { switch (wrapperComponent.ToString()) { case "Ext.Net.Window": Ext.Net.Window window = (Ext.Net.Window)wrapperComponent; GenSql(window.Items); break; case "Ext.Net.Container": Ext.Net.Container ctainer = (Ext.Net.Container)wrapperComponent; GenSql(ctainer.Items); break; case "Ext.Net.FieldSet": Ext.Net.FieldSet fs = (Ext.Net.FieldSet)wrapperComponent; GenSql(fs.Items); break; default: break; } }
protected void Test() { using (BaglantiCumlesi db = new BaglantiCumlesi()) { try { #region Layer 0 List <tbl_sbt_menu> Layer0 = (from p in db.tbl_sbt_menu where p.menu_id == 0 select p).ToList <tbl_sbt_menu>(); if (Layer0.Any()) { #region Create Null Instance Ext.Net.Menu M = null; Ext.Net.ComponentMenuItem CMI = null; Ext.Net.Container C = null; Ext.Net.MenuPanel MP = null; Ext.Net.MenuItem MI = null; Ext.Net.MenuSeparator MS = null; #endregion #region Layer 0 Loop foreach (var i in Layer0) { #region Button Ext.Net.Button B = new Ext.Net.Button(); B.ID = "Button" + i.id; B.Text = i.ad; #endregion #region Layer 1 List <tbl_sbt_menu> Layer1 = (from p in db.tbl_sbt_menu where p.menu_id == i.id select p).ToList <tbl_sbt_menu>(); if (Layer1.Any()) { #region Menu M = new Ext.Net.Menu(); M.ID = "Menu" + i.id; M.ShowSeparator = false; #endregion #region Component Menu i CMI = new Ext.Net.ComponentMenuItem(); CMI.ID = "ComponentMenuItem" + i.id; CMI.Shift = false; #endregion #region Container C = new Ext.Net.Container(); C.ID = "Container" + i.id; C.AutoWidth = true; C.AutoHeight = true; C.AnchorVertical = "100%"; C.Layout = "ColumnLayout"; #endregion #region Layer 1 Loop foreach (var t in Layer1) { #region MenuPanel MP = new Ext.Net.MenuPanel(); MP.ID = "MenuPanel" + t.id; MP.Title = t.ad; MP.Margins = "10 10 10 10"; MP.Menu.ID = "Menu" + t.id; MP.Menu.ShowSeparator = false; #endregion #region Layer 2 List <tbl_sbt_menu> Layer2 = (from p in db.tbl_sbt_menu where p.menu_id == t.id select p).ToList <tbl_sbt_menu>(); if (Layer2.Any()) { int LastID = Layer2[Layer2.Count - 1].id; #region Layer 2 Loop foreach (var y in Layer2) { #region Menu i MI = new Ext.Net.MenuItem(); MI.ID = "MenuItem" + y.id; MI.Text = y.ad; #region URL Check if (!string.IsNullOrEmpty(y.url)) { MI.Icon = Ext.Net.Icon.StarGold; MI.Listeners.Click.Handler = "TabEkle(TabPanel1, '" + MI.ID + "', '" + y.url + "', '" + MP.ID + "', '" + y.ad + "')"; } else { MI.Icon = Ext.Net.Icon.StarHalfGrey; MI.Disabled = true; } #endregion #endregion if (y.id != LastID) { #region Menu Separator MS = new Ext.Net.MenuSeparator(); MS.ID = "MenuSeparator" + y.id; #endregion } #region Adding MP.Menu.Items.Add(MI); #endregion if (y.id != LastID) { #region Adding MP.Menu.Items.Add(MS); #endregion } } #endregion } #endregion #region Adding C.Items.Add(MP); #endregion } #endregion #region Adding CMI.Component.Add(C); M.Items.Add(CMI); B.Menu.Add(M); #endregion } else { B.StandOut = true; } #endregion #region Adding MenuToolbar.Items.Add(B); #endregion } #endregion } #endregion } catch { } /* * try * { * //http://www.superstarcoders.com/blogs/posts/recursive-hierarchical-joins-in-c-sharp-and-linq.aspx * * IEnumerable<DeepNodeData> nodes = elements.RecursiveJoin( * element => element.Id, * element => element.ParentId, * (FlatData element, int index, int depth, IEnumerable<DeepNodeData> children) => * { * return new DeepNodeData() * { * Text = element.Text, * Children = children, * Depth = depth * }; * }); * * foreach (var i in nodes) * { * * } * * var q = (from p in db.tbl_sbt_menu * select new * { * ParentID = p.menu_id, * child = from c in db.tbl_sbt_menu * where c.menu_id == p.id * select new * { * ChildID = c.id, * ParentID = c.menu_id * } * }); * * //var abc = q.Select(p=>p.child).fir * * } * catch * { * * } */ } }
protected override void OnLoad(EventArgs e) { _container = new CustomContainer { ID = ID + "_container" }; Controls.Add(_container); foreach (PropertyData linkDetail in _initialValues) CreateLinkedItemEditor(linkDetail); for (int i = 0; i < AddedEditorCount; ++i) CreateLinkedItemEditor(null); AddNewItemButton(); Controls.Add(new LiteralControl("<br style=\"clear:both\" />") { ID = ID + "_literalControl" }); base.OnLoad(e); }
private void _Count_Radio(System.Web.UI.ControlCollection objcol, string radname) { try { int iID; int iNO; foreach (object obj in objcol) { System.Type itype = obj.GetType(); if (itype.Namespace == "Ext.Net" || itype.Namespace == "System.Web.UI.HtmlControls") { switch (itype.Name) { case "HtmlForm": System.Web.UI.HtmlControls.HtmlForm htmlform = (System.Web.UI.HtmlControls.HtmlForm)obj; _Count_Radio(htmlform.Controls, radname); break; case "Viewport": Ext.Net.Viewport viewport = (Ext.Net.Viewport)obj; _Count_Radio(viewport.Controls, radname); break; case "FormPanel": Ext.Net.FormPanel formpanel = (Ext.Net.FormPanel)obj; _Count_Radio(formpanel.Controls, radname); break; case "Panel": Ext.Net.Panel panel = (Ext.Net.Panel)obj; _Count_Radio(panel.Controls, radname); break; case "TabPanel": Ext.Net.TabPanel tabpanel = (Ext.Net.TabPanel)obj; _Count_Radio(tabpanel.Controls, radname); break; case "Container": Ext.Net.Container container = (Ext.Net.Container)obj; _Count_Radio(container.Controls, radname); break; case "FieldSet": Ext.Net.FieldSet fieldset = (Ext.Net.FieldSet)obj; _Count_Radio(fieldset.Controls, radname); break; case "ContentContainer": Ext.Net.ContentContainer contentcontainer = (Ext.Net.ContentContainer)obj; _Count_Radio(contentcontainer.Controls, radname); break; case "RadioGroup": Ext.Net.RadioGroup radioGroup = (Ext.Net.RadioGroup)obj; _Count_Radio(radioGroup.Controls, radname); break; case "Radio": Ext.Net.Radio radio = (Ext.Net.Radio)obj; string[] s = radio.ID.Split('_'); iID = Convert.ToInt16(s[1]); iNO = Convert.ToInt16(s[2]); if (iID > 1 && iID < 38) { if (radio.Value.Equals(true)) { iSCORE = iSCORE + iNO - 1; } } break; case "": break; } } } } catch (Exception ex) { _ErrorMsgShow(ex.Message.ToString()); } }
/// <summary> /// Lấy fieldname và giá trị /// </summary> /// <param name="control"></param> /// <param name="value"></param> /// <returns></returns> private string GetFieldName(Ext.Net.Component control, ref object value) { switch (control.ToString()) { case "Ext.Net.TextField": Ext.Net.TextField txtControl = (Ext.Net.TextField)control; value = txtControl.Text; if (!txtControl.ID.Contains("_")) { return(""); } else { return(txtControl.ID.Substring(txtControl.ID.IndexOf("_") + 1)); } case "Ext.Net.Hidden": Ext.Net.Hidden hdfControl = (Ext.Net.Hidden)control; value = hdfControl.Text; if (!hdfControl.ID.Contains("_")) { return(""); } else { return(hdfControl.ID.Substring(hdfControl.ID.IndexOf("_") + 1)); } case "Ext.Net.Checkbox": Ext.Net.Checkbox chk = (Ext.Net.Checkbox)control; value = chk.Checked == true ? 1 : 0; if (!chk.ID.Contains("_")) { return(""); } else { return(chk.ID.Substring(chk.ID.IndexOf("_") + 1)); } case "Ext.Net.DateField": Ext.Net.DateField dfDate = (Ext.Net.DateField)control; if (!SoftCore.Util.GetInstance().IsDateNull(dfDate.SelectedDate)) { value = dfDate.SelectedDate.Month + "/" + dfDate.SelectedDate.Day + "/" + dfDate.SelectedDate.Year; } else { value = ""; } if (!dfDate.ID.Contains("_")) { return(""); } else { return(dfDate.ID.Substring(dfDate.ID.IndexOf("_") + 1)); } case "Ext.Net.NumberField": Ext.Net.NumberField nbf = (Ext.Net.NumberField)control; value = nbf.Text; if (!nbf.ID.Contains("_")) { return(""); } else { return(nbf.ID.Substring(nbf.ID.IndexOf("_") + 1)); } case "Ext.Net.ComboBox": Ext.Net.ComboBox cbBox = (Ext.Net.ComboBox)control; value = cbBox.SelectedItem.Value; if (!cbBox.ID.Contains("_")) { return(""); } else { return(cbBox.ID.Substring(cbBox.ID.IndexOf("_") + 1)); } case "Ext.Net.SpinnerField": Ext.Net.SpinnerField spinnerField = (Ext.Net.SpinnerField)control; value = spinnerField.Text; if (!spinnerField.ID.Contains("_")) { return(""); } else { return(spinnerField.ID.Substring(spinnerField.ID.IndexOf("_") + 1)); } case "Ext.Net.TextArea": Ext.Net.TextArea txtArea = (Ext.Net.TextArea)control; value = txtArea.Text; if (!txtArea.ID.Contains("_")) { return(""); } else { return(txtArea.ID.Substring(txtArea.ID.IndexOf("_") + 1)); } case "Ext.Net.Container": Ext.Net.Container cContainer = (Ext.Net.Container)control; GetChildControl(cContainer); break; case "Ext.Net.FieldSet": Ext.Net.FieldSet fieldSet = (Ext.Net.FieldSet)control; GetChildControl(fieldSet); break; case "Ext.Net.HtmlEditor": Ext.Net.HtmlEditor htmlEditor = (Ext.Net.HtmlEditor)control; value = htmlEditor.Text; if (!htmlEditor.ID.Contains("_")) { return(""); } else { return(htmlEditor.ID.Substring(htmlEditor.ID.IndexOf("_") + 1)); } } return(""); }
public Window CreateWinDow(string titleName) { var win = new Window { ID = "wdBaoCaoTongHop", Title = titleName, Width = Unit.Pixel(1000), Height = Unit.Pixel(700), Icon = Icon.Printer, Modal = true, Collapsible = true, Maximizable = true, Hidden = true, AutoHeight = true, ConstrainHeader = true, Padding = 6, Constrain = true, Resizable = false }; // Create items FormPanel editpanel = new FormPanel() { ID = "Panel_Edit", AutoWidth = true, Padding = 10, }; TriggerField ftName = new TriggerField(); ftName.AnchorHorizontal = "100%"; ftName.AutoWidth = true; ftName.FieldLabel = "Tiêu đề báo cáo"; ftName.ID = "txtReportName"; ftName.Text = titleName.ToString(); FieldTrigger ftFieldTrigger = new FieldTrigger { Icon = TriggerIcon.Clear, Qtip = "Xóa trắng", HideTrigger = false }; ftName.Triggers.Add(ftFieldTrigger); ftName.Listeners.TriggerClick.Handler = "txtReportName.reset();"; editpanel.Items.Add(ftName); // end create items // create panel Ext.Net.Container ctn = new Ext.Net.Container() { ID = "ctn", Layout = "ColumnLayout", Height = Unit.Pixel(300), AnchorHorizontal = "100%", }; Ext.Net.Container ctn1 = new Ext.Net.Container() { Layout = "FormLayout", AnchorHorizontal = "100%", LabelAlign = LabelAlign.Top, AutoHeight = true, ColumnWidth = 0.5, }; FieldSet flSet1 = new FieldSet() { AutoHeight = true, Title = "Các trường hiển thị" }; this.gpShow.ColumnModel.Columns.Add(new Column { DataIndex = "ID", Header = "Mã" }); this.gpShow.ColumnModel.Columns.Add(new Column { DataIndex = "Name", Header = "Tên trường", Width = Unit.Pixel(300) }); flSet1.Items.Add(this.gpShow); ctn1.Items.Add(flSet1); Ext.Net.Container ctn2 = new Ext.Net.Container() { AutoHeight = true, LabelAlign = LabelAlign.Top, Layout = "FormLayout", AnchorHorizontal = "100%", ColumnWidth = 0.5, }; FieldSet flSet2 = new FieldSet() { AutoHeight = true, Title = "Các điều kiện lọc" }; this.gpDieuKienLoc.ColumnModel.Columns.Add(new Column { DataIndex = "ID", Header = "Mã" }); this.gpDieuKienLoc.ColumnModel.Columns.Add(new Column { DataIndex = "DescriptionTableName", Header = "Tiêu đề", Width = Unit.Pixel(300) }); // flSet2.Items.Add(this.gpDieuKienLoc); flSet2.Items.Add(gp); ctn2.Items.Add(flSet2); ctn.Items.Add(ctn1); ctn.Items.Add(ctn2); editpanel.Items.Add(ctn); // end panel win.Buttons.Add(btnChon); win.Buttons.Add(Button6); win.Items.Add(editpanel); win.Render(this.Form); return(win); }