private void UpdateStyleCollection() { RaWebControl tmp = this.Control as RaWebControl; if (tmp != null) { tmp.Style.SetStyleValueViewStateOnly("border-style", "dashed"); tmp.Style.SetStyleValueViewStateOnly("border-width", BorderTo + "px"); } }
private void UpdateStyleCollection() { RaWebControl tmp = this.Control as RaWebControl; if (tmp != null) { tmp.Style.SetStyleValueViewStateOnly("display", "block"); tmp.Style.SetStyleValueViewStateOnly("height", ""); } }
private void UpdateStyleCollection() { RaWebControl tmp = Control as RaWebControl; if (tmp != null) { tmp.Style.SetStyleValueViewStateOnly("opacity", "1.0"); tmp.Style.SetStyleValueViewStateOnly("display", ""); } }
internal override void EnsureViewStateLoads() { if (((System.Web.UI.Page)System.Web.HttpContext.Current.CurrentHandler).Request.Params["__RA_CONTROL"] == this.ClientID && ((System.Web.UI.Page)System.Web.HttpContext.Current.CurrentHandler).Request.Params["__EVENT_NAME"] == "dropped") { RaWebControl parent = Parent as RaWebControl; parent.Style.SetStyleValueViewStateOnly("left", Page.Request.Params["x"] + "px"); parent.Style.SetStyleValueViewStateOnly("top", Page.Request.Params["y"] + "px"); if (parent.Style[Styles.position] != "fixed") { parent.Style.SetStyleValueViewStateOnly("position", "absolute"); } } }
private void UpdateStyleCollection() { RaWebControl tmp = this.Control as RaWebControl; if (tmp != null) { if (_left != -1) { tmp.Style.SetStyleValueViewStateOnly("left", _left.ToString() + "px"); } if (_top != -1) { tmp.Style.SetStyleValueViewStateOnly("top", _top.ToString() + "px"); } } }
private void UpdateStyleCollection() { RaWebControl tmp = this.Control as RaWebControl; if (tmp != null) { if (_height != -1) { tmp.Style.SetStyleValueViewStateOnly("height", this._height.ToString() + "px"); } if (_width != -1) { tmp.Style.SetStyleValueViewStateOnly("width", this._width.ToString() + "px"); } } }
private void UpdateBreadCrumb(SlidingMenuLevel to) { ASP.Control idx = to; bool first = true; while (true) { if (idx == null || idx is SlidingMenu) { break; // Finished } else if (idx is SlidingMenuItem) { RaWebControl btn = null; if (first) { btn = new Label(); btn.CssClass = "bread-item-left bread-item-last"; first = false; } else { btn = new LinkButton(); btn.CssClass = "bread-item-left"; btn.Click += btn_Click; } SlidingMenuLevel curLevel = null; foreach (ASP.Control idx2 in idx.Controls) { if (idx2 is SlidingMenuLevel) { btn.ID = "rxB" + idx2.ID; curLevel = idx2 as SlidingMenuLevel; } } Label right = new Label(); right.ID = btn.ID + "rxq"; right.CssClass = "bread-item-right"; btn.Controls.Add(right); Label center = new Label(); center.ID = btn.ID + "cxq"; center.CssClass = "bread-item-center"; center.Text = string.IsNullOrEmpty(curLevel.Caption) ? (idx as SlidingMenuItem).Text : curLevel.Caption; right.Controls.Add(center); _bread.Controls.AddAt(0, btn); } idx = idx.Parent; } // Creating home bread-crumb button RaWebControl home = null; if (to == null) { home = new Label(); } else { home = new LinkButton(); home.Click += btnHome_Click; } home.ID = "BTNbreadGoHome"; home.CssClass = "bread-item-left bread-item-first"; Label right2 = new Label(); right2.ID = home.ID + "r"; right2.CssClass = "bread-item-right"; home.Controls.Add(right2); Label center2 = new Label(); center2.ID = home.ID + "c"; center2.CssClass = "bread-item-center"; center2.Text = " "; right2.Controls.Add(center2); Label centerContent = new Label(); centerContent.ID = home.ID + "cc"; centerContent.CssClass = "sliding-bread-home"; centerContent.Text = " "; center2.Controls.Add(centerContent); _bread.Controls.AddAt(0, home); }
private static Period CalculatePositionOfActivity(int dayNo, IEnumerable<Period> col, Activity idxActivity, Period curActivityPeriod, RaWebControl actLbl, Period curDayPeriod) { if (_maxHeight == 0) { // Calculating max height... _maxHeight = (int)((((float)(DateTime.Now.Date.AddHours(23).AddMinutes(59) - DateTime.Now.Date).TotalMinutes) / 60F) * 15F) + 24; } // Current activity is intersecting with current rendering day int left = (dayNo * 105) + 10; int top; if (curDayPeriod.Start > idxActivity.Start) top = 29; else top = (int)((((float)(idxActivity.Start - curDayPeriod.Start).TotalMinutes) / 60F) * 15F) + 29; int height; if (idxActivity.Start.Date != curDayPeriod.Start) height = (int)((((float)(idxActivity.End - curDayPeriod.Start).TotalMinutes) / 60F) * 15F) - 6; else height = (int)((((float)(idxActivity.End - idxActivity.Start).TotalMinutes) / 60F) * 15F) - 6; height = Math.Min(height, _maxHeight - top); // Checking to see if it overlaps with a previously added activity int zIndex = 100; foreach (Period idxPreviouslyAdded in col) { if (!Period.Intersects(idxPreviouslyAdded, curActivityPeriod)) continue; zIndex += 1; left += 10; } actLbl.Style[Styles.left] = left + "px"; actLbl.Style[Styles.top] = top + "px"; actLbl.Style[Styles.height] = height + "px"; actLbl.Style[Styles.zIndex] = zIndex.ToString(); return curActivityPeriod; }
private void CreateRows(RaWebControl table) { Node node = new Node(); List<Node> tmp = new List<Node>(RowsFiltered); tmp.Sort( delegate(Node left, Node right) { if (SortColumn == null) { // Defaulting to first "sane" sortable... (which is "ID" if given) if (left[0].Name == "ID" && left[0].Value is int) return ((int)left[0].Value).CompareTo((int)right[0].Value); if (left[0].Value == null) return right[0].Value == null ? 0 : - 1; if (right[0].Value == null) return 1; return left[0].Value.ToString().CompareTo(right[0].Value.ToString()); } bool isBackwards = SortColumn[0] == '-'; string sortCol = SortColumn.Replace("-", ""); if (left[sortCol].Value == null) return right[sortCol].Value == null ? 0 : (isBackwards ? 1 : -1); if (right[sortCol].Value == null) return isBackwards ? -1 : 1; object leftObj = left[sortCol].Value; object rightObj = right[sortCol].Value; if (leftObj == null) return rightObj == null ? 0 : (isBackwards ? -1 : 1); if (rightObj == null) return isBackwards ? 1 : -1; if (!isBackwards) return ((IComparable)leftObj).CompareTo(rightObj); return ((IComparable)rightObj).CompareTo(leftObj); }); foreach (Node idx in tmp) { node.Add(idx); } // Settings previous and next buttons to disabled/enabled according to placement in // the datasource paging logic... _previous.CssClass = CurrentPage == 0 ? "previous-disabled" : "previous"; _next.CssClass = (CurrentPage * PageSize) + PageSize >= node.Count ? "next-disabled" : "next"; int idxNo = 0; int idxStartBinding = 0; foreach (Node idxRow in node) { if (PageSize == -1 || idxStartBinding >= CurrentPage * PageSize) { // If PageSize == -1 we add ALL records...!!!! Label row = new Label { Tag = "tr", CssClass = idxNo%2 == 0 ? "even" : "odd", ID = "row" + idxNo }; table.Controls.Add(row); int idxNoCell = 0; foreach (Node idxCell in idxRow) { if (idxCell.Name == "ID") continue; HtmlTableCell cell = new HtmlTableCell { ID = "cell" + idxNo + "x" + idxNoCell }; row.Controls.Add(cell); string fieldType = DataSource["Columns"][idxCell.Name]["ControlType"].Get<string>(); switch (fieldType) { case "LinkButton": { LinkButton lb = new LinkButton { ID = "ctrl" + idxNo + "x" + idxNoCell, Xtra = idxRow["ID"].Value + "|" + idxCell.Name, Text = idxCell.Get<string>() }; if (Action != null) { lb.Click += delegate(object sender, EventArgs e) { LinkButton rl = sender as LinkButton; if (rl == null) return; string id = rl.Xtra.Split('|')[0]; string columnName = rl.Xtra.Split('|')[1]; Action(this, new GridActionEventArgs(id, columnName)); }; } cell.Controls.Add(lb); } break; case "InPlaceEdit": { InPlaceEdit edit = new InPlaceEdit { ID = "ctrl" + idxNo + "x" + idxNoCell, CssClass = "edit", Xtra = idxRow["ID"].Value + "|" + idxCell.Name, Text = idxCell.Get<string>() }; if (CellEdited != null) { edit.TextChanged += delegate(object sender, EventArgs e) { InPlaceEdit ed = sender as InPlaceEdit; if (ed != null) { string id = ed.Xtra.Split('|')[0]; string cellName = ed.Xtra.Split('|')[1]; GridEditEventArgs eIn = new GridEditEventArgs(id, cellName, ed.Text); CellEdited(this, eIn); if (!eIn.AcceptChange) return; Node rowNode = DataSource["Rows"].Find( delegate(Node idxNode) { if (idxNode.Name != "ID") { return false; } return idxNode.Value.ToString() == id; }).Parent; Node cellNode = rowNode.Find( delegate(Node idxNode) { return idxNode.Name == cellName; }); cellNode.Value = eIn.NewValue.ToString(); } }; } cell.Controls.Add(edit); } break; case "List": { SelectList edit = new SelectList { ID = "ctrl" + idxNo + "x" + idxNoCell + idxRow["ID"].Value, Xtra = idxRow["ID"].Value + "|" + idxCell.Name }; string valueSelected = idxCell.Get<string>(); foreach (Node idx in DataSource["Columns"][idxCell.Name]["Values"]) { string idxValue = idx.Get<string>(); ListItem l = new ListItem(idxValue, idxValue); if(idxValue == valueSelected) l.Selected = true; edit.Items.Add(l); } if (CellEdited != null) { edit.SelectedIndexChanged += delegate(object sender, EventArgs e) { SelectList ed = sender as SelectList; if (ed != null) { string id = ed.Xtra.Split('|')[0]; string cellName = ed.Xtra.Split('|')[1]; GridEditEventArgs eIn = new GridEditEventArgs(id, cellName, ed.SelectedItem.Value); CellEdited(this, eIn); if (!eIn.AcceptChange) return; Node rowNode = DataSource["Rows"].Find( delegate(Node idxNode) { if (idxNode.Name != "ID") { return false; } return idxNode.Value.ToString() == id; }).Parent; Node cellNode = rowNode.Find( delegate(Node idxNode) { return idxNode.Name == cellName; }); cellNode.Value = eIn.NewValue.ToString(); } }; } cell.Controls.Add(edit); } break; case "Label": if (idxCell.Value is string) { cell.InnerHtml = idxCell.Get<string>(); } else if (idxCell.Value is DateTime) { cell.InnerHtml = idxCell.Get<DateTime>().ToString( idxCell["Format"].Get<string>(), CultureInfo.CurrentUICulture); } break; case "Link": { if (idxCell["target"].Value != null && idxCell["target"].Get<string>() == "same") cell.InnerHtml = string.Format(@"<a href=""{0}"">{1}</a>", idxCell["href"].Value, idxCell.Get<string>()); else cell.InnerHtml = string.Format(@"<a href=""{0}"" target=""_blank"">{1}</a>", idxCell["href"].Value, idxCell.Get<string>()); } break; default: { if (fieldType.IndexOf("TextAreaEdit") == 0) { int lengthOfText = -1; if (fieldType.Contains("[")) { lengthOfText = int.Parse(fieldType.Split('[', ']')[1]); } TextAreaEdit edit = new TextAreaEdit(); if (lengthOfText != -1) { edit.TextLength = lengthOfText; } edit.ID = "ctrl" + idxNo + "x" + idxNoCell; edit.CssClass = "edit"; edit.Xtra = idxRow["ID"].Value + "|" + idxCell.Name; edit.Text = idxCell.Get<string>(); if (CellEdited != null) { edit.TextChanged += delegate(object sender, EventArgs e) { TextAreaEdit ed = sender as TextAreaEdit; if (ed == null) return; string id = ed.Xtra.Split('|')[0]; string cellName = ed.Xtra.Split('|')[1]; GridEditEventArgs eIn = new GridEditEventArgs(id, cellName, ed.Text); CellEdited(this, eIn); if (eIn.AcceptChange) { Node rowNode = DataSource["Rows"].Find( delegate(Node idxNode) { if (idxNode.Name != "ID") { return false; } return idxNode.Get<string>() == id; }).Parent; Node cellNode = rowNode.Find( delegate(Node idxNode) { return idxNode.Name == cellName; }); cellNode.Value = eIn.NewValue.ToString(); } }; } cell.Controls.Add(edit); } else { Node getColType = new Node(); getColType["ColumnType"].Value = DataSource["Columns"][idxCell.Name]["ControlType"].Get<string>(); getColType["Row"].Value = row; getColType["Value"].Value = idxCell.Value; getColType["DataSource"].Value = DataSource; getColType["ID"].Value = idxRow["ID"].Value; getColType["CellName"].Value = idxCell.Name; ActiveEvents.Instance.RaiseActiveEvent( this, "GetGridColumnType", getColType); RaWebControl ctrl = getColType["Control"].Get<RaWebControl>(); ctrl.ID = idxRow["ID"].Value + "x" + idxCell.Name.GetHashCode().ToString().Replace("|", ""); ctrl.Xtra = string.Format("{0}|{1}", idxRow["ID"].Value, idxCell.Name); if (getColType["ExtraCssClass"].Value != null) { if(!table.CssClass.Contains(getColType["ExtraCssClass"].Get<string>())) { table.CssClass += " " + getColType["ExtraCssClass"].Get<string>(); } } cell.Controls.Add(ctrl); } } break; } idxNoCell += 1; } // Adding delete row (if we should) if (RowDeleted != null) { HtmlTableCell delete = new HtmlTableCell {ID = "del" + idxNo}; LinkButton lb = new LinkButton { ID = "delBtn" + idxNo, Text = " ", CssClass = "deleteBtn", Xtra = idxRow["ID"].Value.ToString(), Visible = EnableDeletion }; lb.Click += delegate(object sender, EventArgs e) { LinkButton bt = sender as LinkButton; if (bt != null) { RowDeleted(this, new GridActionEventArgs(bt.Xtra, null)); if (AutoDeleteRowOnDeletion) { foreach (Node idx in DataSource["Rows"]) { if (idx["ID"].Value.ToString() == bt.Xtra) { DataSource["Rows"].Remove(idx); DataBindGrid(); _lstWrappers.ReRender(); break; } } } } }; delete.Controls.Add(lb); row.Controls.Add(delete); } } idxNo += 1; idxStartBinding += 1; if (idxNo == (PageSize * CurrentPage) + PageSize) break; } }