protected void tree_CustomCallback(object sender, DevExpress.Web.ASPxTreeList.TreeListCustomCallbackEventArgs e) { if (String.IsNullOrWhiteSpace(e.Argument)) { return; } var param = e.Argument.Split(';'); if (param.Length < 2) { return; } var context = new NorthwindDataClassesDataContext(); var currentNode = context.Employees.Where(empl => empl.EmployeeID == Convert.ToInt32(param[0])).FirstOrDefault(); var copyNode = context.Employees.Where(empl => empl.EmployeeID == Convert.ToInt32(param[1])).FirstOrDefault(); if (ProcessNodes(tree.FindNodeByKeyValue(copyNode.EmployeeID.ToString()), currentNode.EmployeeID.ToString())) { copyNode.ReportsTo = currentNode.EmployeeID; //coment the below line to enable updates throw new CallbackException("Updates aren't allowed in online demo"); context.SubmitChanges(); tree.DataBind(); } else { throw new CallbackException("You're trying to move a parent node to its child"); } }
protected void Page_Load(object sender, EventArgs e) { using (var data = new NorthwindDataClassesDataContext()) { var liste = from a in data.Order_Details group a by a.ProductID into g select new { ProductID = g.Key, TotalPrice = g.Sum(x => x.UnitPrice * x.Quantity) }; gv.DataSource = liste; gv.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { using (var data = new NorthwindDataClassesDataContext()) { var liste = ( from a in data.Products orderby a.UnitPrice descending select new { a.CategoryID, a.Category.CategoryName, a.ProductID, a.ProductName, a.UnitPrice }).Take(10); gv.DataSource = liste; gv.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { using (var data = new NorthwindDataClassesDataContext()) { var liste = ( from a in data.Products orderby a.UnitPrice descending select a).Take(20).ToList(); gv.DataSource = liste; gv.DataBind(); // var kullanımı var i = 0; //List<KeyValuePair<int, string>> // anonim tipler var tip = new { Ad = "Alper", Soyad = "Konuralp", No = 5 }; string s = tip.Ad + " " + tip.Soyad; } }