protected void ModifyFilterExpression(string FieldName, object value, ASPxCardView victim) { var criterias = CriteriaColumnAffinityResolver.SplitByColumnNames(CriteriaOperator.Parse(victim.FilterExpression)).Item2; BinaryOperatorType operatorType; if (FieldName == "ProductName") { operatorType = BinaryOperatorType.Like; value += "%"; } else { operatorType = BinaryOperatorType.Equal; } if (!criterias.Keys.Contains(FieldName)) { criterias.Add(FieldName, new BinaryOperator(FieldName, value, operatorType)); } else { criterias[FieldName] = new BinaryOperator(FieldName, value, operatorType); } victim.FilterExpression = CriteriaOperator.ToString(GroupOperator.And(criterias.Values)); }
protected void GridTo_HtmlCardPrepared(object sender, DevExpress.Web.ASPxCardViewHtmlCardPreparedEventArgs e) { ASPxCardView cardView = sender as ASPxCardView; var key = cardView.GetCardValues(e.VisibleIndex, cardView.KeyFieldName); e.Card.CssClass += string.Format(" cardKey_{0}", key); }
public void BindGrids(ASPxCardView grid1, ASPxCardView grid2) { grid1.DataSource = GetDraggableDataSource(); grid1.DataBind(); grid2.DataSource = GetDroppableDataSource(); grid2.DataBind(); }
private static void AddColumn(ASPxCardView cardView, string fieldName, Type fieldType) { Type colType = columnMap.ContainsKey(fieldType) ? columnMap[fieldType] : typeof(CardViewTextColumn); CardViewColumn c = Activator.CreateInstance(colType) as CardViewColumn; c.FieldName = fieldName; cardView.Columns.Add(c); }
protected void ASPxCardView1_CustomButtonCallback(object sender, ASPxCardViewCustomButtonCallbackEventArgs e) { if (e.ButtonID == "FilterBtn") { ASPxCardView cardview = sender as ASPxCardView; cardview.FilterExpression = "[Country] like '%Germany%'"; } }
protected void ASPxCardView1_Init(object sender, EventArgs e) { using (ASPxCardView gv = (sender as ASPxCardView)) { gv.SettingsCookies.CookiesID = MasterGridCookieName; //gv.DataSourceID = "DataSourceMaster"; //gv.KeyFieldName = "ID"; //gv.SettingsText.Title = ""; }; }
protected void ASPxCardView1_CardInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { table = (DataTable)Session["table"]; ASPxCardView cv = (ASPxCardView)sender; DataRow row = table.NewRow(); row["ID"] = e.NewValues["ID"]; row["Data"] = e.NewValues["Data"]; cv.CancelEdit(); e.Cancel = true; table.Rows.Add(row); }
protected void ASPxUploadControl1_FileUploadComplete(object sender, FileUploadCompleteEventArgs e) { try { ASPxCardView card = sender as ASPxCardView; string path = Page.MapPath("~/Image/") + e.UploadedFile.FileName; e.UploadedFile.SaveAs(path); Session["data"] = e.UploadedFile.FileName; } catch (Exception e1) { System.Diagnostics.Debug.WriteLine(e1); } }
protected void ASPxCardView1_CellEditorInitialize(object sender, DevExpress.Web.ASPxCardViewEditorEventArgs e) { ASPxCardView grid2 = (ASPxCardView)sender; if (e.Column.FieldName == "ID") { ASPxTextBox textBox = (ASPxTextBox)e.Editor; textBox.ClientEnabled = false; if (grid2.IsNewCardEditing) { table = (DataTable)Session["table"]; textBox.Text = GetNewId().ToString(); } } }
protected void ASPxCardView1_CardInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { ASPxCardView card = sender as ASPxCardView; ASPxTextBox f = FindPageControl(card).FindControl("f") as ASPxTextBox; e.NewValues["FirstName"] = f.Text; ASPxTextBox l = FindPageControl(card).FindControl("l") as ASPxTextBox; e.NewValues["LastName"] = l.Text; ASPxTextBox j = FindPageControl(card).FindControl("j") as ASPxTextBox; e.NewValues["JeuneFilleName"] = j.Text; ASPxTextBox p = FindPageControl(card).FindControl("p") as ASPxTextBox; e.NewValues["Position"] = p.Text; ASPxDateEdit d = FindPageControl(card).FindControl("d") as ASPxDateEdit; e.NewValues["DateOfBirth"] = Convert.ToDateTime(d.Text); ASPxTextBox m = FindPageControl(card).FindControl("m") as ASPxTextBox; e.NewValues["MaritalStatus"] = m.Text; ASPxTextBox s = FindPageControl(card).FindControl("s") as ASPxTextBox; e.NewValues["SocialSecurityRef"] = s.Text; ASPxTextBox fa = FindPageControl(card).FindControl("fa") as ASPxTextBox; e.NewValues["FatherId"] = fa.Text; ASPxTextBox mo = FindPageControl(card).FindControl("mo") as ASPxTextBox; e.NewValues["MotherId"] = mo.Text; ASPxTextBox st = FindPageControl(card).FindControl("st") as ASPxTextBox; e.NewValues["State"] = st.Text; ASPxDateEdit da = FindPageControl(card).FindControl("da") as ASPxDateEdit; e.NewValues["DeathDate"] = Convert.ToDateTime(da.Text); ASPxTextBox sex = FindPageControl(card).FindControl("sex") as ASPxTextBox; e.NewValues["Sexe"] = sex.Text; ASPxTextBox fax = FindPageControl(card).FindControl("fax") as ASPxTextBox; e.NewValues["Fax"] = fax.Text; ASPxTextBox note = FindPageControl(card).FindControl("note") as ASPxTextBox; e.NewValues["note"] = note.Text; e.NewValues["Photo"] = Session["data"]; }
private void AddColumns(ASPxCardView cardView) { if (cardView == null) { return; } cardView.Columns.Clear(); DataView dw = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty); foreach (DataColumn c in dw.Table.Columns) { AddColumn(cardView, c.ColumnName, c.DataType); } cardView.KeyFieldName = dw.Table.Columns[0].ColumnName; //cardView.Columns[0].Visible = false; }
private bool DeleteButtonVisibleCriteria(ASPxCardView grid, int visibleIndex) { object card = grid.GetDataRow(visibleIndex); return(((DataRow)card)["ProductName"].ToString().Contains("b")); }
protected void ASPxCardView1_CardInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { ASPxCardView card = sender as ASPxCardView; ASPxComboBox TypeCode = FindPageControl(card).FindControl("TypeCode") as ASPxComboBox; e.NewValues["TypeCode"] = TypeCode.SelectedItem.Text; ASPxTextBox Reference = FindPageControl(card).FindControl("Reference") as ASPxTextBox; e.NewValues["Reference"] = Reference.Text; ASPxTextBox BarCode = FindPageControl(card).FindControl("BarCode") as ASPxTextBox; e.NewValues["BarCode"] = BarCode.Text; ASPxTextBox TaxCode = FindPageControl(card).FindControl("TaxCode") as ASPxTextBox; e.NewValues["TaxCode"] = TaxCode.Text; ASPxComboBox UnitCode = FindPageControl(card).FindControl("UnitCode") as ASPxComboBox; e.NewValues["UnitCode"] = UnitCode.SelectedItem.Text; ASPxTextBox Label = FindPageControl(card).FindControl("Label") as ASPxTextBox; e.NewValues["Label"] = Label.Text; ASPxTextBox Description = FindPageControl(card).FindControl("Description") as ASPxTextBox; e.NewValues["Description"] = Description.Text; ASPxDateEdit ObtaningDate = FindPageControl(card).FindControl("ObtaningDate") as ASPxDateEdit; e.NewValues["ObtaningDate"] = Convert.ToDateTime(ObtaningDate.Value.ToString()); ASPxTextBox PurchasingPrice = FindPageControl(card).FindControl("PurchasingPrice") as ASPxTextBox; e.NewValues["PurchasingPrice"] = float.Parse(PurchasingPrice.Text); ASPxTextBox SellingPrice = FindPageControl(card).FindControl("SellingPrice") as ASPxTextBox; e.NewValues["SellingPrice"] = float.Parse(SellingPrice.Text); ASPxComboBox FamilyCode = FindPageControl(card).FindControl("FamilyCode") as ASPxComboBox; e.NewValues["FamilyCode"] = FamilyCode.SelectedItem.Text; ASPxDateEdit DelivryDate = FindPageControl(card).FindControl("DelivryDate") as ASPxDateEdit; e.NewValues["DelivryDate"] = Convert.ToDateTime(DelivryDate.Value.ToString()); ASPxTextBox WarantyPeriod = FindPageControl(card).FindControl("WarantyPeriod") as ASPxTextBox; e.NewValues["WarantyPeriod"] = float.Parse(WarantyPeriod.Text); ASPxTextBox StorageCondition = FindPageControl(card).FindControl("StorageCondition") as ASPxTextBox; e.NewValues["StorageCondition"] = StorageCondition.Text; ASPxTextBox SpecialPrecaution = FindPageControl(card).FindControl("SpecialPrecaution") as ASPxTextBox; e.NewValues["SpecialPrecaution"] = SpecialPrecaution.Text; ASPxComboBox StockTrakingMethodCode = FindPageControl(card).FindControl("StockTrakingMethodCode") as ASPxComboBox; e.NewValues["StockTrakingMethodCode"] = StockTrakingMethodCode.SelectedItem.Text; ASPxComboBox PackagingTypeCode = FindPageControl(card).FindControl("PackagingTypeCode") as ASPxComboBox; e.NewValues["PackagingTypeCode"] = PackagingTypeCode.SelectedItem.Text; ASPxTextBox note = FindPageControl(card).FindControl("note") as ASPxTextBox; e.NewValues["note"] = note.Text; e.NewValues["Photo"] = Session["data"]; }
protected void ASPxCardView1_CustomCallback(object sender, DevExpress.Web.ASPxCardViewCustomCallbackEventArgs e) { ASPxCardView grid = sender as ASPxCardView; ModifyFilterExpression(ASPxComboBox1.Value.ToString(), ASPxTextBox1.Value, grid); }
protected void ASPxCardView1_CustomJSProperties(object sender, ASPxCardViewClientJSPropertiesEventArgs e) { ASPxCardView cv = sender as ASPxCardView; e.Properties["cpVisibleCardCount"] = cv.VisibleCardCount; }
static void BindCardView(ASPxCardView cv) { cv.CancelEdit(); cv.DataSource = Data; cv.DataBind(); }
ASPxPageControl FindPageControl(ASPxCardView card) { return(card.FindEditFormTemplateControl("pageControl") as ASPxPageControl); }